> I am new to jquery. After a lot of trial and errors, I managed to
> accomplish what I wanted: beforesubmitting to a form, I check for php
> errors and then I display them in a div above the submit button. Works
> great. But the problem that I am having, if there are no errors, the
> form submits as wanted BUT the next page displays in the div!!!!!
>
> Can someone kindly complete that one line that is missing in below
> code? Thank you.
>
>
> $(document).ready(function() {
>     var options = {
>         target:        \'#myerror\',
>         beforeSubmit:  showRequest,
>         success:       showResponse
>
>     };
>
>     $(\'#myformOne\').ajaxForm(options);
> });
>
> function showRequest(formData, jqForm, options) {
>     var queryString = $.param(formData);
> }
> function showResponse(responseText, statusText){}
>

The next page is displayed because you're using the target option.
Presumably the server response for the form submit is the next page.
The form plugin takes that and puts it into the target element(s).
That's what the target option is for.  If you're doing some validation
in the beforeSubmit callback then you could set target to null if the
validation succeeds.

Mike

Reply via email to