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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:46:24+00:00 2026-05-18T00:46:24+00:00

EDIT: It seems that the formatting of the json string is not the problem.

  • 0

EDIT: It seems that the formatting of the json string is not the problem. Instead I’m not seeing the json string in the Firebug response section and yet ajax error handlers aren’t being thrown.

Hi!

So I’ve got a web service setup so that it will return a very simple json string:

{"A":1,"Total":1}

After reading several threads on stackoverflow and even on the jquery documentation page for $.ajax, I learned that the correct formatting for the json string is to have each value within double quotes as well.

{"A":"1","Total":"1"}

I’m assuming that is why my jquery ajax is not working:

$.ajax({
    type: "GET",
    url: "http://test/testServices/InfoService.svc/GetInfoStats?pId=76&mId=2117",
    dataType: "json",
    error: function(xml,txtStatus, errorThrown){
        alert(xml + " " + txtStatus + " " + errorThrown);
    },
    success: function (msg, test) {
        alert("JSON DATA LOADED! " + msg);
        $(".MainContainerBottom").html(msg);
    }
});

$('.log').ajaxError(function () {
        $(this).text('Triggered ajaxError handler.');
    });

Firebug’s Console window is telling me that the GET was “200 OK 398ms” consistently and if I check test variable it returns success as well. msn returns null though!
The Params and the Headers section of Firebug also looks good but the Response section is empty.

I was also messing around with the dataType of the $.ajax and had it as jsonp at first and firebug returned an error stating

Invalid Label
{"A":1,"Total":1}

So I know the information is coming back correctly but I can’t access it. I’m assuming it’s because of the formatting issue I began this post with. Is that correct?

Assuming I don’t have the ability to modify the web service myself, what can I do to get the json data out and into my script?

Thank you very much! <3
John

EDIT: For Guffa

Response Headers
Content-Length  39
Content-Type    application/json; charset=utf-8
Server  Microsoft-IIS/7.5
X-Powered-By    ASP.NET
Date    Fri, 12 Nov 2010 21:58:57 GMT

Request Headers
    Host    test
    User-Agent  Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9
    Accept  application/json, text/javascript, */*
    Accept-Language en-us,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

Final Edit:
I spoke to the guy who setup the web service for us and apparently there was some special restrictions on the information being sent back. He setup some permissions for our application to access the data and it worked flawlessly.

Thanks to everyone for your help! I’m really surprised by the amount of people who responded and tried to help me out. I’ll definitely be sticking around the stackoverflow community now and hopefully one day I can help out others as well 🙂

  • 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-18T00:46:24+00:00Added an answer on May 18, 2026 at 12:46 am

    No, there is nothing wrong with the original JSON string. Values doesn’t have to be strings, they can be numbers.

    You have to look for the error elsewhere. Add an error handler in the Ajax call, so that you can get any information about what might be going wrong.

    When you fetch data as JSONP, it expects the result wrapped in a callback call: callback({"A":1,"Total":1});. The code is executed when it’s returned, and as there isn’t a callback call around the object, the brackets around the object literal is instead interpreted as a code block, and the property names are interpreted as code labels. Code labels have to be identifiers, not strings, hence the error message.

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

Sidebar

Related Questions

EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
EDIT: It seems to be something with having the two queues in the same
Is the documentation for Rich Edit Controls really as bad (wrong?) as it seems
Edit: From another question I provided an answer that has links to a lot
Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: This question is more about language engineering than C++ itself. I used C++
EDIT What small things which are too easy to overlook do I need to
Edit : Solved, there was a trigger with a loop on the table (read
edit #2: Question solved halfways. Look below As a follow-up question, does anyone 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.