0

When I run the script but I get a console error of "too much recursion".

Having lookup up this error it refers to a "infinite loop" but I can't see how my code is in a loop. Can anyone see what I have done wrong.

function clickMe() {
  new jBox('Modal', {
    attach: '.pin',
    width: 1000,
    height: 500,
    title: 'Admin PIN',
    theme: 'TooltipBorder',
    closeButton: 'title',
    draggable: 'title',
    trigger: 'click',
    animation: 'false',
    position: {
      x: 'center',
      y: 'center',
    },
    offset: {
      x: 15,
      y: -10
    },
    onCloseComplete: function() {
      this.destroy();
      $('#jBox-overlay').remove();
    },
    ajax: {
      type: 'post',
      url: 'do_login.php',
      data: ({
        "password": 1951
      }),
      success: function(response) {
        if (response == "success") {
          alert("Correct Details");
        } else {
          alert("Wrong Details");
        }
      },
      reload: 'strict'
    }
  });
};

Many thanks in advance for your time.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
DCJones
  • 3,121
  • 5
  • 31
  • 53
  • Possible duplicate of [Avoiding 'too much recursion' error](https://stackoverflow.com/questions/26567046/avoiding-too-much-recursion-error) –  Apr 09 '18 at 14:14
  • [How much research effort is expected of Stack Overflow users?](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users) The answer, *"A lot. An absurd amount. More than you think you are capable of. After you have reached the end of your rope and the pain of not having the answer exceeds the vast amount of shame received by posting your question, that's when you can go ahead and ask. Because at that point, you will have done whatever research necessary to make it a good question worth asking!"* –  Apr 09 '18 at 14:14
  • [What does your step debugger tell you?](http://stackoverflow.com/questions/25385173/what-is-a-debugger-and-how-can-it-help-me-diagnose-problems) –  Apr 09 '18 at 14:15
  • You only show a single function, but not how it is being used. What html element or what piece of script triggers this function? The problem might as well be in the calling code. – Peter B Apr 09 '18 at 14:20
  • @PeterB Thanks for your reply. The HTML that triggers the script is:
    $RoomNo2
    – DCJones Apr 09 '18 at 14:22
  • You might find out more if you put `debugger;` as the first line of `function clickMe() { ... }`, or as the first line of any `function`s that it contains. With a debugger attached, you can then step through the code and hopefully see where it recurses. – Peter B Apr 09 '18 at 14:25
  • @PeterB Thanks Peter, I am working on that right now. – DCJones Apr 09 '18 at 14:26
  • @PeterB Hi again, I could not see any issues with my script in Debugger" so I started to strip back another parts of the script and found that if I remove a link to "jquery-ui-1.7.2.custom.min.js" which is on my server the "too much recursion” error does not occure. The "jquery-ui-1.7.2.custom.min.js" was a download from the JQuery website. – DCJones Apr 09 '18 at 15:40
  • @ Jarrod Roberson I fully understand where your coming from but let me tell you, there is never any shame in asking a question. Just remember, this is how this great web site started, people asking questions. – DCJones Apr 09 '18 at 16:03

1 Answers1

0

I could not see any issues with my script in Debugger" so I started to strip back another parts of the script and found that if I remove a link to "jquery-ui-1.7.2.custom.min.js" which is on my server the "too much recursion” error does not occure. The "jquery-ui-1.7.2.custom.min.js" was a download from the JQuery website

DCJones
  • 3,121
  • 5
  • 31
  • 53