fatiDev
fatiDev

Reputation: 5992

Error: "Too much recursion"

Firebug shows me the following error: too much recursion , I tried a lot to determine what causes me this error, but in vain

This is my JavaScript code:

$(".scan").click(function(e){
    e.preventDefault();
    var docName = $("#nomPJ").val();
    $(this).attr("nomDoc",docName);
});

Another on a separated js file:

$(".scan").live("click",function(event){
    alert("frame");
    var e = event.target;
    nomDoc = $(e).attr("nomDoc");
    idDoc = $(e).attr("idDoc");
    alert("id"+idDoc);
    $("#title").text(nomDoc);
    $("#modal-body").empty().append('<iframe frameBorder="0"  height="90%" width="98%" style="margin-left: 5px"  src="/GRH/Scan.jsp?nomDoc=' + nomDoc + '&idDoc='+idDoc+'"></iframe>');
    $("#myModal").modal({ dynamic: true });
});

The html element:

<a href="" class="scan" idDoc="1" nomDoc="" target="_blanck">numériser</a>

I removed to first code, but the problem still remains.

Upvotes: 2

Views: 11389

Answers (2)

user3276552
user3276552

Reputation: 1072

For those of you trying to actually troubleshoot this in some other application, firebug/fox is pretty rough; chrome will help you out a lot more.

If you're feeling your oats, or can't use chrome, this post saved me from a ton of hassle!

long story short, it goes through logging each function automatically, so

function apples () {
  bananas()
}
function bananas () {
  apples()
}

becomes

function apples () {
  console.log('apples');
  bananas()
}
function bananas () {
  console.log('bananas');
  apples()
}

so that you can see exactly which functions are wrapped up in the all-to-vague "too much recursion"

happy troubleshooting!

Upvotes: 0

Tomas Ramirez Sarduy
Tomas Ramirez Sarduy

Reputation: 17471

Ok, sound like a bug, but I have readed the docs and there is not dynamic option, anyway, is well know that the modal bootstrap plugin has some other bugs like the multiple modal bug.

Posible solutions:

  1. Modify the modal.js which is not recommended
  2. Use another modal plugin. It seems like it works pretty well.
  3. Merge the two click events into one
  4. Delete the dynamic: true option on modal() function, set a fixed width to #myModal and overflow:scroll using css.

Upvotes: 1

Related Questions