4

Internal Error: too much recursionFirefox からエラーが発生しています。jqueryを使ってajax呼び出しをしようとしています。Internet Explorer では問題なく動作しています。

私は再帰的に関数を呼び出していません。

何か提案をください。ありがとう

 $(function(){
      $('#delivery').accordion({
           header: '.accTrigger',
           autoHeight: false,
           animated: 'easeslide',
           change: function(event, ui) {
                alert("here");
                event.preventDefault();
                $.ajax({
                     url: URL,
                     type: 'GET',
                     dataType: 'html',
                     timeout: 18000,
                     success: function(data, textStatus, xhr) {
                          alert("sus");
                     },
                     error: function(xhr, textStatus, errorThrown) {
                          alert("err" + errorThrown);
                     }
                });     

                $("input",ui.newHeader).prop("checked","checked");
                $("input",ui.newHeader).trigger('click');

                $(".accSection").each(function() {
                     $(this).removeClass("active");
                });

                ui.newHeader.parent().addClass("active");
                fitContentBackground();
           }
      });

      /**
      * Loop through all the payment types and enable the respective accordin
      */
      $.each($('.accSection'), function(index, value) {
           if ($('input[type="radio"]', value).is(':checked') == true) {
                $('#delivery').accordion('activate',index);
                $(this).addClass("active");
           } 
           else {
                $(this).removeClass("active");
           }
      });
 });

返信ありがとうございます

コード全体を追加して申し訳ありません。多くの混乱を引き起こしました..

この単純なスニペットでも同じエラーが発生します (InternalError: too much recursion)

$(document).ready(function() {
$("#buttontest123").click(function(evt){
  alert("herepavan");
  evt.preventDefault();

  setPayment();




});

function setPayment()
{   
      alert("here1");
    $.ajax({
        url: 'URL',
        type: 'GET',
        dataType: 'html',

        success: function(data, textStatus, xhr) {

           alert("sus");
        },
        error: function(xhr, textStatus, errorThrown) {
           alert("err"+errorThrown);
        }
    });


}

});

</script>
4

1 に答える 1

3

newHeader要素の要素に対してクリックイベントをトリガーすると、変更イベントが発生すると思います(これは反省的です)

 $("input",ui.newHeader).trigger('click');

上記の行を他のロジックに置き換えてみてください(「クリック」をトリガーせず、必要なコードを呼び出すだけです)

于 2012-11-14T23:38:59.197 に答える