JavaScript – jQuery.load performance


My task is to load content from another page. I needed to add a callback function. After adding it, performance problems started.

Here's the code: $(into).load(url + " " + from, function (){start_page();console.log('CALLBACK');});

Nothing console.log('CALLBACK'); , however, console.log('CALLBACK'); helped me figure out that the callback is being called in a strange way. The first time this function is called 1 time, the second – 2 times, 3 – 5 times, and so on more and more.

Any suggestions?


You re / rewire the event handler where the code is called

$(into).load(url ...

so this code – and the function supplied to load second parameter – is called more and more times.

Scroll to Top