gpt4 book ai didi

javascript - 嵌套 Ajax Get 请求在 IE11 中未触发

转载 作者:行者123 更新时间:2023-12-03 05:45:00 25 4
gpt4 key购买 nike

我在 IE11 中遇到问题,但在 Chrome 或 Firefox 中没有。我有一个 Ajax Get 请求嵌套在 Ajax Post 请求的 Success 函数中,但似乎没有触发。然而,当开发人员工具打开时,它确实会触发并按预期运行。为什么会这样?

            $.ajax({
url: urls.firstUrl,
type: 'POST',
data: { itemId: itemId },
success: function (data) {
$('#aDiv').html(data);
$.ajax({
url: urls.secondUrl,
type: 'GET',
success: function (data) {
$('#aDiv').html(data);
},
error: function (xhr, status, error) {
showErrorAlert(xhr, status, error);
}
});
},
error: function (xhr, status, error) {
showErrorAlert(xhr, status, error);
}
});

最佳答案

在短时间内触发的请求中,IE11将为之前的请求使用缓存。我找到了一个解决方案,在IE11中你必须使用属性CACHE: FALSE,类似的东西:

$.ajax({
url: "test.html",
cache: false
})
.done(function( html ) {
$( "#results" ).append( html );
});

关于javascript - 嵌套 Ajax Get 请求在 IE11 中未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40364165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com