Kumar
Kumar

Reputation: 5147

jquery load() crashes browser when run after form submission

I may be totally wrong here, I am trying to load an iframe as soon as I submit a form. Here is the code

$("#listings-form").submit();
$("#hiddeniframe-listings-form").load(alert('done!'));

Doing this produces too much recursion and even crashes browser, chrome or mozilla.

Upvotes: 0

Views: 635

Answers (2)

fsong
fsong

Reputation: 666

Try commenting out the $("#listings-form").submit(); and check if you still get the too much recursion error. Perhaps the submit event hander for #listings-form was set to call itself causing the infinite recursion.

Upvotes: 0

Alan Haggai Alavi
Alan Haggai Alavi

Reputation: 74202

.load() accepts function reference:

$('#hiddeniframe-listings-form').load(
    function() {
        alert('done!');
    }
);

Upvotes: 1

Related Questions