为什么jQuery的坚持我的明文不为QUOT;良好的"? [英] Why does jQuery insist my plain text is not "well-formed"?

查看:120
本文介绍了为什么jQuery的坚持我的明文不为QUOT;良好的"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个AJAX调用来检索一些纯文本:

I'm making an AJAX call to retrieve some plain text:

$.ajax({
  url:         "programData.txt",
  type:        "GET",
  dataType:    "text",
  cache:       false,
  success:     processData
});

当我提出的要求,不过,我得到以下错误:

When I make the request, though, I get the following error:

错误:没有很好地形成   源文件:文件:///projects/foo/programData.txt _ = 1259694590361?   线路:1,柱:2

Error: not well-formed Source File: file:///projects/foo/programData.txt?_=1259694590361 Line: 1, Column: 2

为什么jQuery的努力来处理我的纯文本以及如何让它停下来?

Why is jQuery trying to process my plain text and how do I get it to stop?

推荐答案

您加载在浏览器中的网页通过HTTP或只是打开它作为一个普通的文件?是否运行的JavaScript以http页面地址:或文件​​:?我怀疑是后者,而阿贾克斯在这种情况下调用不同的工作(见响应由下面tvanfonsson)。如果你正在构建一个web应用程序稍后将通过HTTP,尝试使用本地HTTP服务器上运行你的页面。

Are you loading up the page in your browser over HTTP or just opening it as a regular file? Does the address of the page running the javascript begin with http: or file: ? I suspect it is the latter, and Ajax calls work differently in that situation (see response by tvanfonsson below). If you're building a web app that will be served over HTTP later, try running your page using a local HTTP server.

这篇关于为什么jQuery的坚持我的明文不为QUOT;良好的"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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