Skip to main content
added 1 characters in body
Source Link
user400654
  • 95.1k
  • 16
  • 168
  • 188

If it is current, will it occurs the problem of call stack overflow?

because it call self infinite recursively

If it will occurs such problem, are there any better implementation?

function waitForMsg(){ $.ajax({ type: "GET", url: "xxx.phpphp", async: true, cache: false, timeout: 600000, success: function(data){ handleFunction(data); waitForMsg(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ XMLHttpRequest.abort(); waitForMsg(); } }); } 

If it is current, will it occurs the problem of call stack overflow?

because it call self infinite recursively

If it will occurs such problem, are there any better implementation?

function waitForMsg(){ $.ajax({ type: "GET", url: "xxx.php, async: true, cache: false, timeout: 600000, success: function(data){ handleFunction(data); waitForMsg(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ XMLHttpRequest.abort(); waitForMsg(); } }); } 

If it is current, will it occurs the problem of call stack overflow?

because it call self infinite recursively

If it will occurs such problem, are there any better implementation?

function waitForMsg(){ $.ajax({ type: "GET", url: "xxx.php", async: true, cache: false, timeout: 600000, success: function(data){ handleFunction(data); waitForMsg(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ XMLHttpRequest.abort(); waitForMsg(); } }); } 
Source Link
CL So
  • 3.8k
  • 11
  • 58
  • 101

Is this a current implementation of long-polling?

If it is current, will it occurs the problem of call stack overflow?

because it call self infinite recursively

If it will occurs such problem, are there any better implementation?

function waitForMsg(){ $.ajax({ type: "GET", url: "xxx.php, async: true, cache: false, timeout: 600000, success: function(data){ handleFunction(data); waitForMsg(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ XMLHttpRequest.abort(); waitForMsg(); } }); }