NLCJ Posted August 17, 2010 Share Posted August 17, 2010 Hello, I'm trying to automatically submit a (hidden) form once 30 seconds have passed, I already got the countdown and I got it like this: <form name="hiddenform" id="hiddenform"> <input type="hidden" name="ipaddress" value="<?php echo $_SERVER[REMOTE_ADDR]; ?>" /> <input type="hidden" name="time" value="<?php echo date("H:i:s"); ?>" /> </form> That's the form, now I want JavaScript to post it to another page (without changing the page), I didn't come any further than defining some variables... var ipaddress = document.getElementById('hiddenform').ipaddress.value; var time = document.getElementById('hiddenform').time.value; Quote Link to comment Share on other sites More sharing options...
NLCJ Posted August 17, 2010 Author Share Posted August 17, 2010 Just found this topic: http://www.phpfreaks.com/forums/index.php/topic,307415.0.html I will let you guys know if it works out. EDIT: It does send it, but the page also changes. How do I fix this? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 17, 2010 Share Posted August 17, 2010 If you don't want the page to change but form data to be posted, you need to look into using Ajax. Quote Link to comment Share on other sites More sharing options...
NLCJ Posted August 17, 2010 Author Share Posted August 17, 2010 If you don't want the page to change but form data to be posted, you need to look into using Ajax. Just figured that out before I refreshed the page to request a lock on this thread. Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.