Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ajaxForm(options) what should be passed to the options?

Tags:

jquery

$(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/

like image 249
svk Avatar asked Oct 28 '09 08:10

svk


1 Answers

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

like image 157
jitter Avatar answered Sep 30 '22 16:09

jitter