I've got a jqGrid setup to post to a URL using the content type of application/json:
$("#jqCategoryGrid").jqGrid({
datatype: "json",
mtype: 'POST',
url: "Webservices/TroubleTicketCategory.asmx/getCategoryData",
ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
// **UPDATE - This is the fix, as per Oleg's response**
serializeGridData: function (postData) {
if (postData.searchField === undefined) postData.searchField = null;
if (postData.searchString === undefined) postData.searchString = null;
if (postData.searchOper === undefined) postData.searchOper = null;
//if (postData.filters === undefined) postData.filters = null;
return JSON.stringify(postData);
},
});
The problem is that the jqGrid is still trying to pass parameters using a non-json format so I'm getting an error "Invalid JSON Primitive"
Is there a way to instruct the jqGrid to serialize the data using Json?
Thanks
UPDATE
I edited the provided source code in my question to include the fix I used, which came from Oleg's response below.