gpt4 book ai didi

javascript - 对象不支持使用 AJAX 的此属性或方法

转载 作者:行者123 更新时间:2023-11-30 09:57:32 25 4
gpt4 key购买 nike

请看下面的代码:

$.ajax({
type: "POST",
url: "Results1.aspx/TableQuery",
data: JSON.stringify({
mappingid: res[i],
strCon: $("#fieldGenieConnectionString")[0].value,
strTypeSession: $("#fieldTypeSession")[0].value
}),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess(i, res.length),
error: OnError,
failure: function (response) {
alert('there was a failure loading the webpage')
}
});

和下面的代码:

function OnSuccess(i, totalrows) {
return function (response) {
//if (response.d != "") {
var strResponse = response.d;
strResponse = strResponse.toUpperCase;
if (strResponse.indexOf("<TR>") > 0) {
// alert(response.d);
document.getElementById('div' + i).innerHTML = document.getElementById('div' + i).innerHTML + '<br>' + '<br>' + response.d;
}
numSucceeded++;
var completeCalculation = (numSucceeded / totalrows) * 100
var rounded = completeCalculation.toFixed(0);
document.getElementById('ProgressIndicator').innerHTML = rounded + ' % complete';
document.getElementById('ProgressIndicator2').innerHTML = rounded + ' % complete';
if (numSucceeded === totalrows) {
var end = new Date().getTime();
var htmlResponse = "Loaded after: " + (end - start) / 1000 + " seconds"
document.getElementById('TotalTimeLabel').innerHTML = htmlResponse;
document.getElementById('TotalTime2Label').innerHTML = htmlResponse;
$("#LoadingImage").hide();
$("#LoadingImage2").hide();
}
}
}

以下行会导致错误:

if (strResponse.indexOf("<TR>") > 0) {

最佳答案

strResponse = strResponse.toUpperCase;

这里有错别字。我想你想写 strResponse = strResponse.toUpperCase();

您正在为 strResponse 分配一个函数,而不是在现有的 strResponse 上调用 toUpperCase()

关于javascript - 对象不支持使用 AJAX 的此属性或方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33348756/

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