javascript 如何在 jQuery 文件中提醒 getJSON 响应?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4734631/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to alert getJSON response in jQuery file?
提问by DEVOPS
How to check the response of getJSON function call in jQuery file. Which function do I have to edit?
如何检查 jQuery 文件中 getJSON 函数调用的响应。我必须编辑哪个功能?
回答by polarblau
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
您可能需要使用 JSON 库才能使其工作:http: //www.json.org/js.html

