I need to send a few hidden variable to the struts controller on auto submit of the form. I am sending the variables just fine but since I have the form submit in the document on ready function. The form re submits infinitely . I need to stop the submit after first time submit . Any suggestions ? Below is what I tried.
Code
<script>
$(document).ready (function () {
document.getElementById ('action').value ='hello';
document.getElementById ('myform').submit ();
})
</script>
<form action="/rlogin" id="myform">
<input type=hidden id=user value=you>
<input type=hidden id=action />
Check weither a variable created after the submit has been created or not.
$(document).ready (function () {
if (typeof mySent == 'undefined') {
document.getElementById ('action').value ='hello';
document.getElementById ('myform').submit ();
mySent = true;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.