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

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

It seems nothing out of the ordinary, however, console.log('CALLBACK'); helped me understand that callback is called in a strange way. The first time this function is called 1 time, the second - 2 times, 3 - 5 times and so more and more.

Have any suggestions?

    1 answer 1

    You repeatedly / repeatedly hang the event handler in which the code is called

     $(into).load(url ... 

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

    • Brilliant! I did not think about it ... Thank you so much! - LISS
    • @LISS To health. Successes! - Igor