sovon
sovon

Reputation: 907

after each successful response, request again

From my html page, the ajax request response will works like a loop. That mean's when a successful response come back, again a request will go. I did like the following but that works for only 2 consecutive request-response and I also can understand why.

 $.get("chat1", function(data, status){
    $("#data").html(data);
    $.get("chat1", function(data, status){
        $("#data").html(data);
    });     
});

But, i want to make it automatic. How can i do this? FYI: i am trying to implement long polling.

Upvotes: 0

Views: 49

Answers (1)

kvn
kvn

Reputation: 2300

Use $.get(this) to make the same request again in the success callback function.

Upvotes: 1

Related Questions