Reputation: 9294
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
Reputation: 78667
$.ajax({
type: 'post',
url: 'http://mymegafiles.com/rapidleech/index.php',
data: $('#formId').serialize()
});
Upvotes: 3
Reputation: 6973
Assuming the fields are all part of a form, you'll be wanting to use $('form').serialize()
Upvotes: 1