I'm trying to append data to a form collection via ajax, My code is as follows:
var AjaxSendData = $('form').serialize();
$.ajax({
data: {
'searchtext': searchtext,
'numofres': numofres,
'orderbydesc': orderbydesc,
'columnnum': columnnum,
'pagenum': pageNum,
'contenttype': contenttype,
'MediaFilterType': MediaTypeID,
'status': status,
'ResultsFilterID': ResultsFilterID,
'FilterIdType': FilterIdType
},
type: 'POST',
url: $('#hiddenajaxurl').val() + '?' + AjaxSendData,
cache: false,
dataType: 'json',
success: function (result) {
//...
}
});
My Issue is that on the C# side it only sees the things in ajax data: as a form collection the rest of the request is not there. I tried sending AjaxSendData as the ajax data and append to it using an Associative array ie:
//AjaxSendData['searchtext'] = searchtext;
However this cause a 500 error. Does anybody know how I can combine these so I can get the data back out of the FormCollection?