problem with multiple ajax HTTP get requests with different imput variables using jQuery
- by Thanasis
I want to make asychronous get requests and to take different results based on the input that I provide to each one. Here is my code:
param=1;
$.get('http://localhost/my_page_1.php', param, function(data) {
alert("id = "+param);
$('.resul 5.t').html(data);
});
param=2;
$.get('http://localhost/my_page_2.php', param, function(data) {
alert("id = "+param);
$('.result').html(data);
});
The result for both requests is:
"id = 2"
I want the results to be:
"id = 1" for the 1st request, and
"id = 2" for the second one..
I want to do this for many requests in one
HTML file and integrate the results into the
HTML as soon as they are ready.
Can anyone help me to solve this problem?
thank you in advance,
Thanasis