views:

134

answers:

3

Hello,

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.

A: 

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

Noon Silk
+1  A: 

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

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