gpt4 book ai didi

javascript - 使用 JQuery 的 IE 中的堆栈溢出(第 12/1076 行)

转载 作者:行者123 更新时间:2023-12-02 20:43:59 24 4
gpt4 key购买 nike

我正在使用来自 Google CDN 的 JQuery,并且在第 12 行(对于最小文件)和第 1076 行(对于未压缩文件)出现堆栈溢出错误(使用 IE8)。堆栈溢出错误将我带到的行的 JQuery 代码是:

JQuery.js...

makeArray: function( array ) {
var ret = [];

if( array != null ){
var i = array.length;
// The window, strings (and functions) also have 'length'
// @ALL : this is the line i am getting error on ...
if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
ret[0] = array;
else
while( i )
ret[--i] = array[i];
}

return ret;
},

...

这是我的代码:...

  $(document).ready(function(){
$("#newcmpgn").validate({
errorElement:'dt',
rules:{agree: "required"},
messages:{agree: "You need to accept to Terms and Conditions in order to continue."}
});
$("#newcmpgn").submit(function(){
if($("#newcmpgn").valid()){
var ubal = Number($("#userbalance").val());
var camt = Number($("#amount").val());
if(ubal > camt){
$("#newcmpgn").attr('action', '<?= site_url('account/payments/actpayment/'.$cmpgn_id) ?>');
return true;
}
if($("#autorenew").attr('value') == 'Y'){
$("#newcmpgn").attr('action', '<?= site_url('account/payments/makepayment/'.$cmpgn_id) ?>');
}else{
$("#newcmpgn").attr('action', '<?= site_url('account/payments/makesinglepayment/'.$cmpgn_id) ?>');
}
$("#newcmpgn").submit();
return true;
}
return false;
});
});

提交表单时出现错误。我在这里看不到任何会让 IE8 开始提示堆栈溢出的递归代码?

谢谢,深度。

最佳答案

您正在提交函数内调用 $("#newcmpgn").submit();

这对我来说看起来是递归的!

关于javascript - 使用 JQuery 的 IE 中的堆栈溢出(第 12/1076 行),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1768855/

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