3

How to check the response of getJSON function call in jQuery file. Which function do I have to edit?

2
  • You mentioned a different product in ever 4 lines of text and virtually zero ways to help you. Please give more indications on what is wrong. Commented Jan 19, 2011 at 11:27
  • (1) there's no such thing as a jquery file, unless you're talking about a javascript holding jquery. (2) We don't know what functions you're talking about. (3) You just can't "alert an object", alerts take a string message, and object needs to be converted to a string first. If you replace getJSON with get you get to see the raw response instead of JSON. Commented Jan 19, 2011 at 11:29

1 Answer 1

13

I've to agree with the comments above — your question is more than vague! So I'm now only guessing if that's what you want:

$.getJSON('ajax/test.json', function(data) {
  alert(JSON.stringify(data));
});

You might have to required the JSON library for this to work: http://www.json.org/js.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.