【发布时间】:2015-03-24 22:46:45
【问题描述】:
ajax done 接收 json 文件时不会触发。它打印出 json 对象 客户端
$.ajax({
type: "POST",
url: url,
processData: false,
dataType: 'json',
contentType: 'application/json',
data: data
}).done(function() {
console.log( "Sample of data:");
alert("hello");
}).fail(function() {
console.log("ajax failed ");
});
在服务端,我从客户端获得了 json 文件
def post(self):
print self.request.body
print tornado.escape.json_encode(self.request.body)
self.set_header("Content-Type", "application/json")
self.write("{}")
在浏览器上,我没有看到任何错误代码。我得到 200。但控制台输出“ajax 失败” 请帮忙
【问题讨论】: