I am using the JQuery 1.9.1 . This question may be a possible duplicate of some previous questions.But those are out of date.So I need an upto date solution.
For my java application , I am sending a continuous request to the tomcat server
for every 10 sec
through JQuery-Ajax
to get the data like ,
function startPolling(){
$.ajax({
type: "POST",
cache: false,
url: "My URL",
dataType: "html",
timeout: 10000,
success: function(response) {
if(response != null && response !="" && response !="null")
$("#sucess").html(response);
},
error: function(xhr) {
xhr.abort();
//alert('Error: ' + e);
},
complete: function(xhr, status) {
xhr.abort();
startPolling();
},
});
}
Please make sure am I abort/cancel
the client side
previous request in proper manner.
Also how do I abort the server side request processing
, Before sending the new request through ajax.
Hope our stack users will help me.