Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 759097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:33:22+00:00 2026-05-14T15:33:22+00:00

I am using the latest version of jqGrid : 3.6.4 This seems like a

  • 0

I am using the latest version of jqGrid: 3.6.4

This seems like a simple problem (or at least it did before I spent a few hours on it):

When the grid sends a request to the server (to a controller action), its content-type is always:

application/x-www-form-urlencoded; charset=UTF-8

and I would like it to be:

application/json; charset=utf-8

but I can find no way of setting the content-type (there is no contentType option as you would find on a $.ajax call for example).

So just to clarify, I am not asking how to set the content-type on a jQuery server request, but specifically using jqGrid, which does not provide an obvious option for doing this.

Thanks, Nigel.

Update:
Oleg’s response fixed solved it.

Here are the option settings for the grid:

jQuery("#ContactGridList").jqGrid({
        url: '/ContactSelect/GridData/',
        datatype: 'json',
        ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
        mtype: 'POST',
        ...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:33:22+00:00Added an answer on May 14, 2026 at 3:33 pm

    How you can find in the code of grid.base.js the $.ajax call filling the grid contain looks like following:

    $.ajax($.extend({
        url: ts.p.url,
        type: ts.p.mtype,
        dataType: dt,
        data: $.isFunction(ts.p.serializeGridData) ?
                 ts.p.serializeGridData.call(ts, ts.p.postData) : ts.p.postData,
        complete: function (req, st) {
           ...
        }
        ...
    }, $.jgrid.ajaxOptions, ts.p.ajaxGridOptions));
    

    So you can use ajaxGridOptions option of jqGrid to set or override any parameter of $.ajax request. Because I use only JSON requests to my server, I set general setting of contentType like

    $.extend($.jgrid.defaults, {
        datatype: 'json',
        {ajaxGridOptions: { contentType: "application/json" },
        {ajaxRowOptions: { contentType: "application/json", type: "PUT" },
        ...
    });
    

    The ajaxRowOptions are used in grid.inlinedit.js for row editing. For the form edit there are other parameters, which I set also as global setting:

    $.extend($.jgrid.edit, {
        ajaxEditOptions: { contentType: "application/json" },
        ...
    });
    
    $.extend($.jgrid.del, {
        ajaxDelOptions: { contentType: "application/json" },
        mtype: "DELETE",
        ...
    });
    

    How you can see my server is a RESTfull service (developed mainly in WFC and the rest in ASP.NET MVC). Because $.jgrid.edit is a setting for both “add” and “modify” items, I could not change mtype: "PUT" for “edit” only, so I do this in parameters of navGrid().

    The last ajax parameter which you could find also interesting to set is ajaxSelectOptions. You can set it on the same way as ajaxGridOptions. Parameters of ajaxSelectOptions are useful if you use dataUrl parameter inside of editoptions or searchoptions. I use, for example, dataUrl inside of colModel for defining columns of the type edittype: 'select'. The possible values of select option will be loaded from server for inline or form editing or inside of search dialog. Because for such data loading are used ajax, there is corresponding ajaxSelectOptions option.

    Best regards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jqGrid, latest version, and when I apply a edit rule that is
Using the latest version of ShareKit to post URLs like so: [SHKFacebook shareURL:[NSURL URLWithString:@http://www.google.com]];
Using the latest version of Resharper (4.5.x) with VS2008. Every now and then (pretty
I'm using the latest version of the jquery plugin DataTables and I tried to
I'm using XAMPP (latest version) on OS 10.6.2, that's bundled with PHP 5.3.0 I
Hello i am using the latest version of artoolkit, and succesfully compiled simplevrml, but
I am using the latest version of protobuf-net with VS2008 integration. I have created
I am using wordpress latest version. Currently my blog is set to custom permalink
I'm using the latest version of Gradle (milestone 9), and I'm trying to figure
I'm new to SVN. I'm using the latest version (svn 1.6.9, TortoiseSVN 1.6.7.18415). Some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.