I was looking over this jquery timer on jsfiddle and it works pretty well. However I want to submit a single form field every x amount of seconds. So for an HTML form like:
<form id="form">
<input id="first_name" />
<input type="hidden" id="referrer" />
</form>
I would like to submit only the #referrer field to a specific URL without refreshing, redirecting, etc. Possbile? The back end where this is located is not performing any redirects or anything, I just need to get that field value to the backend every so often.
Would I be needing $(#form).submit(){ //do something} since I’m not actually submitting a form? Just sending a variable to another URL.
Ideas? Thanks.
jQuery has a nice load of Ajax methods.
You seem to be using the GET method, because that is the default for
form(<form method="get">), so the$.get()function seems fine for you. Something along the lines of:This will send a GET request to
specific_urlwith the query string set toreferrer=the_value. Please read the linked documentation on how to use this method.