2017-03-06 87 views
1

我收到最大的调用堆栈错误,无法找出原因。它说jQuery的,我只使用jQuery是我的AJAX ....未捕获的RangeError:超出的最大调用堆栈大小 - ajax

jquery.min.js:6未捕获的RangeError:最大调用堆栈大小超过

这里是我的代码

function processPhase3(){ 
    client_info.primary_email = _("emailAddress").value; 
    client_info.phone = _("cphone").value; 
    client_info.primary_text = _("cphone").value; 
    client_info.primary_voice = _("cphone").value; 
    client_info.hphone = _("cphone").value; 
    client_info.agree = _("agree"); 

    // if check true 
    // then check if email or number in the text field 
    if(client_info.agree.checked == false){ 
     _("alertThree").style.display = "block";  
    }else{ 
     _("alertThree").style.display = "none"; 
    } 
    if(client_info.phone.length > 3 || client_info.primary_email.length > 3){ 
     _("alertFour").style.display = "none"; 
     _("phase3").style.display = "none"; 
     _("phase4").style.display = "block"; 
     _("progressBar").classList.remove("progress-bar-success"); 
     _("progressBar").className += ' progress-bar-success'; 
     _("progressBar").style.width = '100%'; 
     _("status").innerHTML = "Congratulations!"; 
      $.ajax({ 
      type: 'POST', 
      data: client_info, 
      url: "my_prefs_save.php" 
     }); 
    }else{ 
     _("alertFour").style.display = "block"; 
    } 

}

+0

其中是client_info实例化?你能告诉我们一个console.log(client_info)的样子吗? –

+1

供您参考http://stackoverflow.com/questions/6095530/maximum-call-stack-size-exceeded-error – CaptainHere

+0

您可以查看错误中提供的堆栈跟踪以了解问题的起源地点吗? –

回答

0

谢谢你们,

看起来增加了一些return语句解决了这个问题;)

function processPhase3(){ 
    client_info.primary_email = _("emailAddress").value; 
    client_info.phone = _("cphone").value; 
    client_info.primary_text = _("cphone").value; 
    client_info.primary_voice = _("cphone").value; 
    client_info.hphone = _("cphone").value; 
    client_info.agree = _("agree"); 

    // if agree check is true - proceed if countOne = 1, false turn on error 
    // if pn or email exist - proceed countTwo = 1, else turn on error 
    // then check if email or number in the text field 
    if(client_info.agree.checked == true){ 
     _("alertThree").style.display = "none"; 
    }else{ 
     _("alertThree").style.display = "block"; 
     return; 
    } 
    if(client_info.phone.length > 3 || client_info.primary_email.length > 3){ 
     _("alertFour").style.display = "none"; 
     _("phase3").style.display = "none"; 
     _("phase4").style.display = "block"; 
     _("progressBar").classList.remove("progress-bar-success"); 
     _("progressBar").className += ' progress-bar-success'; 
     _("progressBar").style.width = '100%'; 
     _("status").innerHTML = "Congratulations!"; 
      $.ajax({ 
      type: 'POST', 
      data: client_info, 
      url: "my_prefs_save.php" 
     }); 
    }else{ 
     _("alertFour").style.display = "block"; 
     return; 
    } 
相关问题