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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:49:38+00:00 2026-05-26T08:49:38+00:00

When I retrieve data from my localhost as JSON everything is OK. When I

  • 0

When I retrieve data from my localhost as JSON everything is OK. When I try to get that JSON data from a remote machine everything is OK too. I can parse that JSON data comes from my localhost into objects( a datagrid plugin: jqgrid renders it). However when I try to use remote source it doesn’t. At firebug it says 200 OK but it shows an error icon and writes it red. I checked the differences between my localhost and remote connection headers and I found that there is not that header at remote connection:

X-Requested-With    XMLHttpRequest

I think problem may be that. I wasn’t setting it and it was working well. It occurs at remote request.

Any ideas to solve it?

PS: I tried setting Ajax headers but didn’t work:

    $.ajaxSetup({
          headers: {"X-Requested-With":"XMLHttpRequest"}
    });

    $("#userTable").jqGrid({
        url:'http://xx.xx.x.xxx:8080/aa/bb/cc/user',
        colNames:['User Name','Password'],
        colModel:[
            {name:'userName',index:'userName', width:100},
            {name:'password',index:'password', width:55}
        ],
        jsonReader: ...
        ...
    });

When I use that setup I can not even see the GET Request from Firebug.

PS: I use Spring 3 with REST and Tomcat as web server.

  • 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-26T08:49:39+00:00Added an answer on May 26, 2026 at 8:49 am

    I think that you have the Cross-site scripting issue. The problem can be solved if the server set some additional options in the HTTP header of the response. So the solution is not in the modifying of the client code like you do currently, but in the server code.

    I recommend you examine the HTTP options which will be set in the HTTP header by tables.googlelabs.com used in the demo from the answer. You will see that the server response has the following additional HTTP options:

    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    

    and the JSON response will be placed inside of the call of the function defined by jsonCallback parameter. If you would use jsonCallback=? jqGrid will generate the name of the function (something like jQuery16407707202236448429_1319101394784). You can read more about X-XSS-Protection option here and about X-Content-Type-Options: nosniff option here.

    How you can see in the demo, the data will be displayed in the jqGrid, so the Cross-site scripting can be implemented in the jqGrid.

    Because we call the server tables.googlelabs.com, which not support jqGrid paging and sorting parameters, I used in the demo

    url: 'http://tables.googlelabs.com/api/query?jsonCallback=?',
    postData: "sql=" + encodeURIComponent("SELECT * FROM 333136 LIMIT 10")
    

    The usage of string instead of object as the postData value will overwrite any other jqGrid parameters which are typically posted. In you case it will be not needed to do this and probably you need just use url: 'http://xx.xx.x.xxx:8080/aa/bb/cc/user?jsonCallback=?'.

    In any way you need implement support of JSONP on your server. It means just that the server should “understand” jsonCallback parameter. The implementation depends on your server side implementation. It could be just crossDomainScriptAccessEnabled="true" binding setting for the webHttpBinding in case of WCF service (see here an example of the web.config). See this answer and this one (or this one) additionally for ASP.NET Web services and ASP.NET MVC.

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

Sidebar

Related Questions

I'm trying to get a simple GXT application to retrieve data from an external
I am using JDBC to retrieve data from a database. I understand that a
I have an HTML form that builds a drop-down from json data that is
how do i retrieve data from a table within a loop or something. That
Everytime i retrieve data from a mysql stored procedure with a concat function an
I'm trying to retrieve data from an SQL Server 2000 server, and place into
I'd like to retrieve data from a specific webpage by using urllib library. The
Iam trying to retrieve data from mysql database into stylesheet.php but it is not
I'm attempting to retrieve data from a SolarWinds network performance database (MS SQL 2005)
I'm trying to retrieve data from an Entity in Core Data where I know

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.