model-view-controllerjquerydefaultmodelbinder

how to pass another parameter from jquery ajax to mvc controller, along with form.serialize()


I use a jQuery plugin called jscroller, which uses jquery.ajax to make ajax calls. I need to pass in all parameters from a search form, and deliver them to mvc controller, and I think the best way is to put in 'data' field the following expr':

$('#formId').serialize();

My problems is that I need to pass, along with the form values, a 'page' value which is being changed with each call.

How can I put the page value, along with the 'serialize' expression in 'data' field, or is there really another more efficient way to do it?


Solution

  • I think

    var formdata = $('#formId').serialize();
    data: (formdata ? formdata + "&" : "") + "page=" + pageId
    

    will solve your problem