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 5843111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:06:32+00:00 2026-05-22T12:06:32+00:00

I’m trying to set up jqgrid with JSON data. my problem is that the

  • 0

I’m trying to set up jqgrid with JSON data.
my problem is that the data returned from my service is in xml format.
I’ve tracked the request sent by the grid in firebug, and here’s what it says:

Request Headers
Host    localhost
User-Agent  Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Accept  application/json, text/javascript, */*; q=0.01
Accept-Language en-gb,en;q=0.5
Accept-Encoding gzip, deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive  115
Connection  keep-alive
Content-Type    application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With    XMLHttpRequest
Referer http://localhost/sample/sampleUserSearchPage.htm
Content-Length  60
Cookie  ASP.NET_SessionId=yfx42t45b0nidn45yztqzsun

notice the Content-Type field.
I’ve compared this to another jQuery.ajax request I was making, and I noticed that the only difference was in the Content-Type field. on the other request (which returned json), the Content-Type was application/json; charset=UTF-8;
i think that’s the problem, but i couldn’t find on the jqgrid docs how to change that.
attached is my jquery code:

$("#grid").jqGrid({
        url: 'SampleScriptService.asmx/GetGridData',
        datatype: "json",
        mtype: "POST",
        jsonReader : { root: "rows" },
        colNames: ['Username', 'Full Name', 'Monitor?', 'Schedule?', 'Reports?', 'Administrator?', 'Password'],
        colModel: [
            { name: 'username', key: true, index: 'id', jsonmap: 'Username' },
            { name: 'fullname', index: 'invdate', width: 90 , jsonmap: 'FullName' },
            { name: 'ismonitor', index: 'name', width: 100, jsonmap: 'IsMonitor' },
            { name: 'isschedule', index: 'amount', width: 80, jsonmap: 'IsSchedule' },
            { name: 'isreports', index: 'tax', width: 80, jsonmap: 'IsReports' },
            { name: 'isadministrator', index: 'total', width: 80, jsonmap: 'IsAdministrator' },
            { name: 'password', index: 'note', width: 150, jsonmap: 'Password' }
             ],
        rowNum: 10,
        viewrecords: true,
        caption: "Simple data manipulation",
    });

and the web service method:

[WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public GridData GetGridData(int page, int rows, /*string sixd,*/ string sord)
        {
            var arr= new UsersController().SearchUsers("", 10, 0).ToArray(); //this returns an array of User objects.
            GridData retVal = new GridData() { page = 1, records = 6, total = 34, rows = arr };

            return retVal;
        } 
  • 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-22T12:06:33+00:00Added an answer on May 22, 2026 at 12:06 pm

    Probably the main problem which you have: you should add additional parameters to jqGrid:

    ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
    serializeGridData: function (postData) {return JSON.stringify(postData);}
    

    Then the request from jqGrid will require JSON data. You can for example download the old demo project or read more information here.

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

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text

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.