JSON Feed使用jQuery getJSON时返回null [英] JSON Feed Returning null while using jQuery getJSON

查看:83
本文介绍了JSON Feed使用jQuery getJSON时返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://portlandonline.com/shared/cfm/json.cfm ?c = 27321

它返回空值.我真的没有这个机会.我必须让服务器管理员根据自己的喜好更新供稿,因此,如果您可以告诉我如何使它按原样工作,而无需在HTML中添加标签,请告诉我.我将把它与jQuery一起使用,并且我一直在尝试使用getJSON来返回空值.

It's returning null. I don't really have access to this. I have to have a server admin update the feed to my liking, so if you can tell me how to get this to work as is, without adding tags to my HTML please let me know. I will be using this with jQuery, and ive been trying to use getJSON which is what returns null.

$.getJSON('http://portlandonline.com/shared/cfm/json.cfm?c=27321',function(json){
    alert(json);
});

返回空值的

.但是,例如,如果我使用flickr feed,它就可以正常工作.它返回应有的内容[onject Object].有什么想法吗?

that returns null. But if i use a flickr feed for example, it works fine. it returns what it should, [onject Object]. Any ideas?

我发现这是因为HTTP响应标头设置为application/json,而应设置为text/html

推荐答案

JSON显然无效.将其剪切并粘贴到 http://www.jsonlint.com/中,以获取有关语法错误的更多详细信息.您正在使用的JSON解析器发生故障,也许另外一个解析器会更宽松.

The JSON is not valid apparently. Cut and paste it into http://www.jsonlint.com/ for more details on the syntax error. The JSON parser you are using is failing, perhaps another one will be more lenient.

这篇关于JSON Feed使用jQuery getJSON时返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆