I am using jQuery 3.1.0 and UWamp 3.1.0 to run this script.
I want to create a script that can connect to a server to complete a chain of repetitive tasks; This server does not belong to my domain.
I will only send code starting with AJAX calls, as I think these are the ones that cause leaks
This first part connects to the previously calculated link and loads a list of other links to connect (the parser simply returns the contents of the given URL).
$.post("php/parser.php", {
url: uri
}, function(res, status) {
The answer always contains several links, and I need to connect to the first, make a few more calls, and only then can I go to the second, then to the third, etc.
Links are stored in the URLs of the array.
console.log("Request to: " + urls[0]);
urls[0] = $.post("php/parser.php",
{
url: urls[0]
},
function(res, state) {
console.log(0 + ": completed");
}
);
for(var y = 0; y < urls.length;) {
$.when(urls[y]).done(function(res) {
console.log("Doing stuff");
y++;
if(y < urls.length) {
console.log("Request to: " + urls[y]);
urls[y] = $.post("php/parser.php",
{
url: urls[y]
},
function(res, state) {
console.log(y + ": completed");
}
);
}
}, function(res) {});
}
});
:
Chrome/IE , $when (urls [y]). Done() , URL- [0].state() .
Firefox, , (, f10, , 6 ), , , console.log(), , , ( ), , 30 .
, ; script, Firefox 480 :
debug- > 500 6s
→ 7 30
( , - )
js/jQuery/php, - ; - , , . .
: , ,