I am making an Ajax call through jQuery as follows.
$.ajax({
type:"GET",
cache:false,
url:"SomeURL",
data:{
input : some_var,
}, // multiple data sent using ajax.
async: false,
success: function (response) {
console.log("Success");
$("#progress-textarea").append(response + "\n");
},//sucess
failure: function (response) {
console.log("Failure");
$("#progress-textarea").append("Failed to Execute " + final_command + "\n");
}//fail if anything wrong happens
});
Lets say I get the following response,
This is line 1
// Performing some action that takes time..
This is line 2
// Performing some action that takes time..
This is line 3
// Performing some action that takes time..
This is line 4
// Performing some action that takes time..
This is line 5
// Performing some action that takes time..
This is line 6
// Performing some action that takes time..
This is line 7
// Performing some action that takes time..
This is line 8
// Performing some action that takes time..
This is line 9
// Performing some action that takes time..
This is line 10
I am getting the response in one go, all together. I am appending the response to a textbox to show some progress of execution. How can I implement the Ajax call so as to get the response line by line and append each line into the textarea immediately?