【发布时间】:2010-07-26 07:10:58
【问题描述】:
为什么我在 ie6 和 ie7 中使用 json 时出现错误,而其他浏览器却没有?
我正在解析:
$.getJSON('http://www.brettbarros.com/wordpress/?post_type=projects&json=get_post&include=title,content,attachments&post_id=8', function(data) {
alert(data);
});
我正在解析来自 wordpress 插件 JSON API 的 json 提要: http://wordpress.org/extend/plugins/json-api/other_notes/
您可以在此处查看测试/错误:http://brettbarros.com/ietest.html
编辑 2:“数据”似乎为空。我不知道为什么。
编辑 3:这是我的标题...有人看到它们有什么问题吗?如果是这样,我将如何解决它?
Date Mon, 26 Jul 2010 08:31:11 GMT
Server Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.7a mod_fcgid/2.3.5 Phusion_Passenger/2.2.15 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By PHP/5.2.13
X-Pingback http://brettbarros.com/wordpress/xmlrpc.php
Content-Disposition attachment; filename="json_api.json"
Vary Accept-Encoding
Content-Encoding gzip
Content-Length 719
Keep-Alive timeout=5, max=98
Connection Keep-Alive
Content-Type application/json; charset=UTF-8
【问题讨论】:
-
查看请求的标头,它们在告诉你什么。
-
GET /wordpress/?post_type=projects&json=get_post&include=title%2Ccontent%2Cattachments&post_id=8 HTTP/1.1[CRLF] 主机:www.brettbarros.com[CRLF] 连接:close[CRLF] User-代理:Web-sniffer/1.0.36 (+web-sniffer.net/)[CRLF] Accept-Encoding: gzip[CRLF] Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7[CRLF] Cache-控制:no[CRLF] Accept-Language:de,en;q=0.7,en-us;q=0.3[CRLF]Referer:web-sniffer.net/[CRLF]
-
在您更改 Internet Explorer 7 中的代码之前,我获得了美伊关系项目或类似项目。
-
谢谢安德斯。我现在已经在ie7中工作了,但不是ie6。这是一个说明 json 文件未加载的测试页面:brettbarros.com/ietest.html
标签: javascript jquery json