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

  • Home
  • SEARCH
  • 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

I'm trying to reset the formatting in my RichTextBox (WinForms, not WPF). I was
I have an HTML page that uses AJAX to retrieve messages from a server.
I'm looking for a routine that will format a string of numbers as a
How can I configure it so that when I create and edit files in
It seems that in PostgreSQL, empty_field != 1 (or some other value) is FALSE
Rails has a nice idiom that makes it easy for you to have a
I am working on a project right now that involves receiving a message from
I want to remove dots in acronyms but not in domain names in a
I redefined some maths functions (so that they're faster -ie: less accurate-, or use
Python 2.6 defines str.format(…) , which, from Python 3.0, is preferred to the old

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.