Shishant
Shishant

Reputation: 9294

automatic form post data

I have a form with lots of data to be posted, so i was wondering if there is any way to get all the data to be posted automatically.

like for example i sent data this way

$.ajax({
        type: 'post',
        url: 'http://mymegafiles.com/rapidleech/index.php',
        data: 'link=' + $('#link').val() + '&yt_fmt' + $('#yt_fmt').val(),

     });

but there are so many fields that it doesnt look a good idea to me.

Thank You.

Upvotes: 0

Views: 628

Answers (3)

redsquare
redsquare

Reputation: 78667

$.ajax({ 
    type: 'post',
    url: 'http://mymegafiles.com/rapidleech/index.php',
    data: $('#formId').serialize()
});

Upvotes: 3

Gavin Gilmour
Gavin Gilmour

Reputation: 6973

Assuming the fields are all part of a form, you'll be wanting to use $('form').serialize()

Upvotes: 1

Noon Silk
Noon Silk

Reputation: 55082

You can just call '.submit()' on the form?

Upvotes: 0

Related Questions