views:

516

answers:

1

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 ...

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

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?

Thanks, Dw.

+1  A: 

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

That looks recursive to me!

redsquare
yeah - that did it! foolish me - totally ignored that. was supposed to do just "return true". thanks a lot for pointing.
Dw