使用JQuery在IE中进行堆栈溢出(第12/1076行) [英] Stack Overflow in IE with JQuery (at line 12/1076)

查看:178
本文介绍了使用JQuery在IE中进行堆栈溢出(第12/1076行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用来自Google CDN的JQuery,我在第12行(对于min文件)和1076(对于未压缩的文件)中遇到了堆栈溢出错误(使用IE8)。堆栈溢出错误带给我的行的JQuery代码是:

I'm using JQuery from Google CDN and I've been getting stack overflow error (using IE8) at lines 12 (for the min file) and 1076 (for the uncompressed one). The JQuery code at the line where stack overflow error takes me to is:

JQuery.js
...

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;
},

...

这是我的代码:
...

Here's my code: ...

  $(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开始为堆栈耗尽而哭泣?

The Error is coming up while Submitting the form. I can't see any recursive code in here that'd make IE8 start crying about running out of stack?

谢谢,
Dw。

Thanks, Dw.

推荐答案

您正在调用 $(#newcmpgn)。submit(); inside提交功能。

You are calling $("#newcmpgn").submit(); inside the submit function.

这看起来像是递归给我的!

That looks recursive to me!

这篇关于使用JQuery在IE中进行堆栈溢出(第12/1076行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆