开发者

How to run an ajaxcall after another completes?

Just wondering, in my opinion the code below is able to run a second ajaxfunction when the first one completes.

if(xmlHttp) // xmlHttp is an XMLHttpRequest开发者_JAVA百科 object
  {
    xmlHttp.onreadystatechange = function()
    {
      if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
      {
         // second call can be made here because a first one is ready?
      }
   }

Am I correct on this? Or do I misunderstand the thing I want to achieve?


yes you can do that, but it might be better to call a function that does your second request flow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜