更新2:
我没有提到我在 Chromium 中没有收到以下错误,但在 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 数据的网页时,我在浏览器中收到以下客户端错误消息:
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"}]
为什么会发生这种情况以及如何阻止错误消息的出现?
最佳答案
同样的问题,context.Response.ContentType="text/plain";
让我很开心...
关于jquery - 我收到 JSON 的 XML 错误消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6070465/