【发布时间】:2011-12-16 14:25:46
【问题描述】:
IE7 在运行以下代码时抛出异常:"jquery: parseerror"。它适用于我测试过的所有其他浏览器(Firefox、Opera、Chrome、Chromium)。
脚本:
function check(){
$("#form").ajaxSubmit({
url: "/send-file",
dataType: "json",
success:
function(answer){
$("#result").html(answer.msg);
},
error:
function(jqXHR, textStatus, errorThrown){
alert(textStatus);
}
});
return false;
}
服务器脚本(Pylons 的控制器):
@jsonify
def sendFile(self):
response.content_type = "text/plain"
response.cache_control = 'no-cache'
response.pragma = "no-cache, must-revalidate"
response.expires = "-1"
data = dict(msg = '<h1 id="sd">ffffffffff</h1> \
<p>ddddd</p> <a href="#">link</a>' )
return data
【问题讨论】:
-
您可以发布来自服务器的示例响应吗?
-
来自服务器的响应:{"msg": "
ffffffffff
ddddd
链接"}