2

Here is my code:

<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8"%>
<% 
// some code
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Temp </title>
</head>
<body>
<form name="EventConfirmRedirection" method="post" action="event-buy-ticket.jsp">
    <input type="hidden" value="<%=seance_id%>" id="seanceId" name="seanceId"></input>
    <input type="hidden" value="<%=selected_seat_count%>" id="urlField" name="seatCount"></input>
    <input type="hidden" value="<%=seat[0]%>" id="seatId1" name="seatId1"></input>
    <input type="hidden" value="<%=ticket_cost[0]%>" id="ticketCost1" name="ticketCost1"></input>

    <input type="submit" value="Go" >
</form> 
</body>
</html>

I can post the values to the next page. When I click "Go", it posts. That's OK. The problem is I don't want to use <input type="submit" value="Go"> or something like visible on the screen. I am trying to do this automatically. When this page come, then it should directly post "event-buy-ticket.jsp".

Tried to do this with javascript but i couldn't. Maybe there is a simple way with HTML.

ged
  • 23
  • 1
  • 1
  • 5

3 Answers3

5

This should do the trick with javascript

document.EventConfirmRedirection.submit();
Mark Baijens
  • 11,932
  • 10
  • 39
  • 66
4
<script type="text/javascript">
window.onload = function() {
   document.forms["EventConfirmRedirection"].submit();
}
</script>
Shadow The Vaccinated Wizard
  • 62,584
  • 26
  • 129
  • 194
0

See JavaScript post request like a form submit

Community
  • 1
  • 1
magnattic
  • 11,529
  • 10
  • 59
  • 109