Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html post automatically

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.

like image 805
ged Avatar asked Jul 13 '26 05:07

ged


1 Answers

This should do the trick with javascript

document.EventConfirmRedirection.submit();
like image 63
Mark Baijens Avatar answered Jul 14 '26 19:07

Mark Baijens



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!