jQuery文件上传:
$('#fileupload').fileupload({
xhrFields: {withCredentials: true},
url: 'http://URL/images/pre/',
add: function (e, data) {
var that = this;
$.ajax({
type : 'get',
url : 'http://URL/images/pre/',
dataType : 'jsonp',
jsonp : 'jsonp',
success : function(result) {
url = result.url.replace(...);
data.url = url;
data.submit();
}
});
}
});
data.submit()将POST发送到appengine,返回302(webapp.RequestHandler中的redirect())。 重定向后是否可以从此POST获得响应?
答案 0 :(得分:1)
不幸的是答案是你不能。 ajax请求将被透明地重定向,您将从最终页面获得结果。
我不是进行重定向,而是在响应数据中包含重定向位置,并使用法线200和所需数据进行响应。