Answer the question
In order to leave comments, you need to log in
Access received data from another ajax request using userscript?
This data is obtained using a script that is located on the site, after which the DOM tree begins to be filled with elements that are filled with this data.
I need to get this data as soon as it arrives, without waiting for the DOM to be built based on it into some function in userscript.
How can I do that?
Answer the question
In order to leave comments, you need to log in
Actually, I figured out how to do it. I decided to unsubscribe here to help those who stumble upon this topic in search of an answer to this question.
$( document ).ajaxComplete(function( event, xhr, settings )
{
//Check the url to which the request is sent, as for me it's better to do it through the regular expression as shown below:
if(!settings.url.match(/scripts\ /_get_bank_safe\.php/g))
return true;
//Parse the response as JSON and put the json with the response into data. Then we do what we want with the date.
var data = $.parseJSON(xhr.responseText);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question