tags:

views:

36

answers:

1
$(document).ready(function() { 
    var options = { 
        target:        '#output1',   // target element(s) to be updated with server response 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse  // post-submit callback

    }; 

    $('#myForm1').ajaxForm(options); 
}); 
function showRequest(formData, jqForm, options) { 

    var queryString = $.param(formData); 

     alert('About to submit: \n\n' + queryString); 

    return true; 
} 


function showResponse(responseText, statusText)  { 

    alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
        '\n\nThe output div should have already been updated with the responseText.'); 
}

In the above program what is passed in the option argument?I use the http://jquery.malsup.com/

A: 

What is your question?

Please elaborate.

From the jQuery Form Plugin API Documentation:

ajaxForm

Prepares a form to be submitted via AJAX by adding all of the necessary event listeners. It does not submit the form. Use ajaxForm in your document's ready function to prepare your form(s) for AJAX submission. ajaxForm takes zero or one argument. The single argument can be either a callback function or an Options Object. Chainable: Yes.

Note: You can pass any of the standard $.ajax options to ajaxForm

jitter