gpt4 book ai didi

javascript - 此页面上的脚本可能正忙,或者可能已停止响应。 ASP.net

转载 作者:行者123 更新时间:2023-12-01 01:48:15 24 4
gpt4 key购买 nike

我的一个页面在 Firefox 中出现此错误:

A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.

这是我的 jquery 代码:

 function uploadComplete(sender, args) {
var imgDisplay = $get("imageEmployeeTemp");
var img = new Image();
img.onload = function () {
imgDisplay.style.cssText = "height:100px;width:100px";
imgDisplay.src = img.src;
};
img.src = "/Resources/Images/Employee/" + args.get_fileName();
}

$(document).ready(function () {
$('#TxBx_BasicSalary').focusout(function () {

var EmployeeId = $('#Hid_EmpID').val();
if (EmployeeId == 0) {
return;
}
$.ajax({
type: "POST",
cache: false,
contentType: "application/json; charset=utf-8",
url: '/WebService/IncDedWebService.asmx/GetInceDed',
data: '{ "id": "' + EmployeeId + '" }',
dataType: 'json',
success: function (data) {
var data = $.parseJSON(data.d)
var TotalIncentives = data["TotalIncentives"];
var TotalDeduction = data["TotalDeduction"];
var BasicSalary = $("#TxBx_BasicSalary").val();
var GrossSalary = parseInt(BasicSalary) + parseInt(TotalIncentives)
$('#Ltrl_GSalary').html(GrossSalary);
$('#Hid_GSalary').val(GrossSalary);
$('#Ltrl_NetSalary').html(GrossSalary - parseInt(TotalDeduction));
$('#Hid_NetSalary').val(GrossSalary - parseInt(TotalDeduction));
},
error: function () { alert("error"); }
});
});
var id = "#<%= Rtb_PayMode.ClientID %>";
var bool = false;
$(id).click(function () {
HideShowRows();
bool = true;
});

if (!bool) {
HideShowRows();
}
function HideShowRows() {
var BankInfo = $('#BankInfo');
var BankAccount = $('#BankAccount');
if ($('#<%= Rtb_PayMode.ClientID %> input:checked').val() == '1') {
BankInfo.hide();
BankAccount.hide();
}
else {
BankInfo.show();
BankAccount.show();
}
}
});

请帮我做什么。

最佳答案

您可以尝试设置一个标志来停止多个并发的 ajax 请求:

     $(document).ready(function () {
var inProgress = false;
$('#TxBx_BasicSalary').focusout(function () {

if(!inProgress){
inProgress = true;
var EmployeeId = $('#Hid_EmpID').val();
if (EmployeeId == 0) {
return;
}
$.ajax({
type: "POST",
cache: false,
contentType: "application/json; charset=utf-8",
url: '/WebService/IncDedWebService.asmx/GetInceDed',
data: '{ "id": "' + EmployeeId + '" }',
dataType: 'json',
success: function (data) {
inProgress = false;
var data = $.parseJSON(data.d)
var TotalIncentives = data["TotalIncentives"];
var TotalDeduction = data["TotalDeduction"];
var BasicSalary = $("#TxBx_BasicSalary").val();
var GrossSalary = parseInt(BasicSalary) + parseInt(TotalIncentives)
$('#Ltrl_GSalary').html(GrossSalary);
$('#Hid_GSalary').val(GrossSalary);
$('#Ltrl_NetSalary').html(GrossSalary - parseInt(TotalDeduction));
$('#Hid_NetSalary').val(GrossSalary - parseInt(TotalDeduction));
},
error: function () { alert("error"); }
});
}
});

关于javascript - 此页面上的脚本可能正忙,或者可能已停止响应。 ASP.net,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16622931/

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