L
L
LemanRass212016-06-18 13:03:07
JavaScript
LemanRass21, 2016-06-18 13:03:07

Access received data from another ajax request using userscript?

1485c90ec2.jpg
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

2 answer(s)
L
LemanRass21, 2016-06-19
@LemanRass21

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);
}

R
Rou1997, 2016-06-18
@Rou1997

Можно "подделать" запрос, то есть отправить его самому, и получить данные, а лучше переходите хотя бы на Phantom.js

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question