Autosubmit form

Advert test
Status
Not open for further replies.
#1
Hi all,

I'm hoping you can help me with this issue which probably has a simple solution that I'm unaware of.

I have a simple form on index.php with two fields. These fields are updated every 10 seconds with longitude and latitude of the users gps location.

Code:
<FORM name="gps">
<INPUT TYPE="text" NAME="long" VALUE="">
<INPUT TYPE="text" NAME="long" VALUE="">
   <input type="submit" name="submit" value="submit"/>
</FORM>
<div id="parsed"></div>
I then have a external jQuery script which when the form is submitted by the user posts the variables to parsegps.php and returns the rendered output to <div id="parsed"> back in index.php.

Code:
$(document).ready(function(){
    $('#gpsform form').submit(function(){
        $.get('parsegps.php', $(this).serialize(), function(data){
            $('#parsed').html(data);
        });
        return false;
        setTimeout('getLocation()',10000);
    });
});
Now the problem I have is that I would like the form to somehow submit the data every 10 seconds without user input. I have tried a <body Onload="document.myform.submit()"> on 10 second increments (not this actual code of course but you get the idea) but it does play friends with the jQuery script.

Can anyone please advise on how this might be accomplished. Maybe through changing the Jquery code. Sorry but jQuery as you can tell is not really my area.

Cheers
 
Status
Not open for further replies.
Top