我刚开始使用Ajax,我不明白为什么在发出请求后不将其重定向到索引?
代码如下:
var request = jQuery
.ajax({
crossDomain: true,
url: url_post_end,
method: "GET",
datatype: "json",
beforeSend: function() {
$("#End_btn").prop("disabled", true);
},
})
.done(function(data) {
window.location = "index.html";
});
我还尝试过:
var request = jQuery.ajax({
crossDomain: true,
url: url_post_end,
method: "GET",
dataType: "json",
beforeSend: function() {
$("#End_btn").prop("disabled", true);
},
success: function(data) {
window.location = "index.html";
}
});
它接收到的json的形式为:{"imgname": "bla", "folder": "/ ssa /"}
有人可以告诉我为什么页面不重定向到索引吗?感谢帮助!