Results of disordered requisitions

0

I have 1 textarea with several lines, each line of this textarea I have data to make a post request in a single url, it checks each line and sends me the result on the screen via jquery, the problem and that the results that are printed in the screen are not sorted according to the data placed in the textarea, should print the results in the form of a list of lines 1, 2, 3, 4 of the textarea in sequence, but he printa this in disorderly 4, 2, 1, 3 he checks if a proxy and port work example 292.168.391.34 | 8080 and the request is made on a page putting the data before the | in the input of the proxy and after the separator in another input of the port, and with preg_match I capture the message of connected and with an if I make to print in the screen the message if it was successful or not along side of the line tested, more always the results come back cluttered not hitting as the dryness in the textarea how do I solve it?

    
asked by anonymous 11.07.2017 / 17:51

1 answer

0

You need to note that ajax is asynchronous so it can give you the answer to a request that was made before one that was made before. So to solve this you could do the first request and then in the callback function of this one to perform the other and so on, in the order you need. I do not know the jquery syntax but here's an example:

function callback2 () {
    ajax3(callback3);
}
function callback1 () {
    ajax2(callback2);
}
ajax1(callback1);
    
12.07.2017 / 02:58