Jquery JQGrid breaks when contentType=application/json?

Posted by JK on Stack Overflow See other posts from Stack Overflow or by JK
Published on 2010-05-16T21:11:14Z Indexed on 2010/05/16 21:20 UTC
Read the original article Hit count: 776

Filed under:
|
|
|

I've had to use $.ajaxSetup() to globally change the contentType to application/json

$.ajaxSetup({
  contentType: "application/json; charset=utf-8"
});

(See this question for why I had to use application/json http://stackoverflow.com/questions/2792603/aspnet-mvc-why-is-modelstate-isvalid-false-the-x-field-is-required-when-that)

But this breaks the jquery jqrid with this error:

Invalid JSON primitive: _search

The POST data it is trying to send is:

_search=false&nd=1274042681880&rows=20&page=1&sidx=&sord=asc

Which of is not in json format, so of course it fails. Is there anyway to tell jqrid what contenttype to use?

I have searched on the jqrid wiki, but doesn't have much documentation about anything really.

http://www.trirand.com/jqgridwiki/doku.php?do=search&id=contenttype&fulltext=Search

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jqgrid