Hi ,

If u dont wana use javascript to submit form then remove onSubmit event,
&
If u want to submit it with ajax then remove action attribute & add "*return
false;*"


regards
Ragx
On Mon, Feb 9, 2009 at 1:07 PM, Vivek <narula.vi...@gmail.com> wrote:

>
> Hi,
>
> I am fiddling with an form and calling an function which is using the
> Ajax calls. Below is the code that i am using.
>
> <script language="javascript" type="text/javascript" src="jq.js"></
> script>
> <script language="javascript" type="text/javascript">
> function submitting()
> {
>
>  $.ajax({
>   type: "POST",
>   url: "some.php",
>   data: "name=John&location=Boston",
>    success: function(msg){
>     alert( "Data Saved: " + msg );
>    }
>
>  });
>  return true;
>  }
> </script>
> <form action="myaction.php" method="post" onsubmit="return submitting
> ()">
> <input type="text" name="name"/><br/><br/>
> <input type="text" name="email"/><br/><br/>
> <input type="submit" name="mysub" value="Submit">
> </form>
>
> When i try to submit this form it directly goes to the action file of
> form that is "myaction.php" so without finishing the request sent to
> the some.php from the ajax call.
>
> To Resolve this i had put this attribute  " async: false "  in the
> above ajax call. that works however it takes a bit of time before the
> form starts submitting so this can be annoying for the users.
>
> In some.php i am retrieving the data and just sending an email.  ALSO
> i don't wanna use javascript's submit()  function.
>
> How can i resolve this issue. Please help
>
> Thanks !!
>

Reply via email to