I\'m trying to send multiple post within a do while loop but the result is not added
This is because of the async behavior of ajax: Here is a modified version:
var initval = 1;
var endval = 5;
function action(){
var action_string = 'txtuser=someone';
$.ajax({
type: "POST",
url: "http://localhost/js.php",
data: action_string,
success: function(result){
$('div#append_result').append(initval + ',
');
initval++;
if(initval<=endval)
action();
}
});
}
This is now somewhat a sequential approach. Note: I assumed every ajax request returns success, if there is an error, you should handle them on the error callback.