1
I have a script that needs to be executed only after the return of a page request, because the request returns HTML content, and the function I want to execute soon after, implements that received HTML. The problem is I can’t touch the other functions because my access is limited.
I already know that these requests are made when I click on the link that in the image I called "TRIGGER", however, the answers not only arrive in very varied times, but also change the order of return for being asynchronous.
I just need to recognize when first response (of the code I cannot change) come to me, only then I run my script that brings the second answer.
My temporary solution was to use the setTimeout() to perform my function 4 seconds after clicking the TRIGGER link (My courses), because for my tests, even with a "reasonable" internet, it gives time to receive all requests.
Below I show the header of the first answer. Would anyone have any idea what I could do?
If I understand correctly, you want to do a kind of Thinker to check any changes in the page that have to do with the return of the first answer, that’s it?
– Sam
Exactly. I looked for examples but... nothing.
– GOliveira
As much as it is working with the setTimout() It is noticed delay in the execution of the 2nd request, because, as much as the 1st answer arrives, the second is set fixed to only run after 4 seconds, long enough for new users to think it’s not working and end up clicking again on link. I made myself clear, @Dvd ?
– GOliveira
Yes... after calling the second function of the second answer, what happens? the page will be reloaded after? This second function, moves the same div as the first?
– Sam