you can do this
<form .... onsubmit='return false'>
and then
$("form#RegForm").submit(function()
{
$.get("servertime.php",function(response)
{
response=response.split("\n");
$("#serialnumber").val(response[0]);
$("#passcode").val(response[1]);
});
url = 'http://localhost/reg.php';
data = $('#RegForm').serialize();
$.post(data, url , function(){ ... put your call back
here ... });
--- > if you want to move to another page just call javascript
redirection :)
});
On Jul 22, 7:22 pm, HairyJim <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I created a form which I wanted to submit using jQuery (I'm new to jq)
> but before the submit I wanted to run an ajax request and attach the
> returned result to the form for posting. However it seems the form
> submits before the ajax request is returned, I can see the code
> generated in the DB but it never gets attached to the form.
>
> If I set the return false; and hit submit the ajax process runs and is
> attached to the forms hidden field correctly but obviously the form
> does not get submitted, any thoughts for a 'green skin' on this
> matter?
>
> <script type="text/javascript">
> $(document).ready(function()
> {
> $("form#RegForm").submit(function()
> {
> $.get("servertime.php",function(response)
> {
> response=response.split("\n");
> $("#serialnumber").val(response[0]);
> $("#passcode").val(response[1]);
> });
> return true;
> });});
>
> </script>
>
> Cheers
> Jim