我得到JSON XML错误消息? [英] I'm getting an XML error messages for JSON?

查看:172
本文介绍了我得到JSON XML错误消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新2:

我没有提到我没有得到低于铬的错误,但我得到它在IE8。

I did not mention that I do not get the error below in Chromium, but I do get it in IE8.

更新1:

Response Headers:
HTTP/1.1 200 OK
Date: Fri, 20 May 2011 15:40:23 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: application/json; charset=utf-8
Content-Length: 85

原题:

我产生JSON数据,当jQuery的访问这很完善的网页服务器端。但是,当我浏览到实际产生的JSON数据的网页,我在浏览器中得到以下客户方的错误消息:

I have a serverside page which generates json data, which works perfectly well when accessed by jquery. However, when i navigate to the webpage which actually generates the json data, I get the following clientside error message in the browser:

The XML page cannot be displayed 
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. 


--------------------------------------------------------------------------------

Invalid at the top level of the document. Error processing resource 'http://companyname.com/json/data.aspx?id=7

[{"key":7,"value":"Default"}]

为什么这种情况发生,我怎么能阻止出现错误信息?

Why does that happen and how can I stop the error message from appearing?

推荐答案

出现错误,因为JSON数据可能担任类型text / xml和浏览器尝试间preT的输出格式为XML。如果任其作为应用程序/ JSON这很可能不会发生。为什么你想,虽然直接访问的页面?

The error appears, because the JSON data is probably served as type text/xml and your browser tries to interpret the output as XML. If you served it as application/json that would probably not happen. Why would you want to directly access the page though?

这篇关于我得到JSON XML错误消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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