How to post a form using jquery?

501 Views Asked by At

Possible Duplicate:
submit a form using jquery

Hello friends

How can I submit a form using jquery. My form contain one file field also how can I post my form with out reloading the whole page. Any body can help me with some sample code?

3

There are 3 best solutions below

0
On BEST ANSWER
$.ajax({
    type: 'post',
    url: 'servletToUSe',
    data: {
        "fieldValue": $('#fieldName').val()
    },
    success: function () {
        //response handler
    }
1
On

As always nettuts provide a great tutorial for this - Submit A Form Without Page Refresh using jQuery

0
On

Probably the simplest way is to use jQuery Form plugin, which can be found on http://jquery.malsup.com/form/

Then in the simplest option you just need to put below mention code:

$(document).ready(function () {
    $('#your_form_id').ajaxForm();
});

See the plugin's documentation for further details.