gpt4 book ai didi

javascript - 在我的浏览器控制台上调用 ajax 时获取 "[Deprecation] "

转载 作者:行者123 更新时间:2023-12-03 00:27:44 26 4
gpt4 key购买 nike

我正在进行 ajax 调用,它正在成功实现并加载我的数据。在我的浏览器控制台上,我收到 主线程上的同步 XMLHttpRequest 已被弃用,因为它会对最终用户的体验产生不利影响。如需更多帮助http://xhr.spec.whatwg.org/

代码

$("#formIdoutletwisetable").submit(function(event) {
event.preventDefault();
$.ajax({
async: true,
url : "DateWiseOlWiseSales",
method : "POST",

data : {
Outlet : currentlyClickedOutlet,
},
});
$.ajax({
async: true,
url : "NoData",
method : "GET",
dataType : "json",
contentType: "application/json; charset=utf-8",
data : {
fromdate : $("#startdate").val(),
},
success : function(data) {
// console.log("firstdata",data.length);
if(data.length>1)
{
$.ajax({
async: true,
url : "DateWiseOlWiseSales",
method : "GET",
dataType : "json",
contentType: "application/json; charset=utf-8",
data : {
fromdate : $("#startdate").val(),
},
success : function(data) {
// console.log("tst",data);
$("#formIdoutletwisetable").hide();
let formatedData = formatData(data);
renderTable(formatedData);
}
});
}
else
{
alert('No data found between dates');
window.location = 'Somelocation.html';
}
}
});

});

我已经添加了进行 ajax 调用的一份报告的完整代码。

即使我对[Deprecation]缺乏深入的了解,我是否做错了什么?这对我的应用程序有害吗?

console i mage

我正在使用未缩小的jquery,然后单击控制台右侧的链接,我得到如图所示的结果

最佳答案

您是否在返回的内容中包含了脚本标记。喜欢:

<html> 
<head></head>
<body></body>
</html>
<script src="script path"></script>

您可以使用 jQuery 的 getScript() 来获取脚本内容,而不是像上面的代码那样使用。请找到下面的示例代码

<script type="text/javascript">
var script_path = "js script path";
$.getScript(script_path);
</script>

您也可以在这里查看You can check example here

关于javascript - 在我的浏览器控制台上调用 ajax 时获取 "[Deprecation] ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54016827/

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