开发者

How to create new HTTP GET If the older is loaded [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
开发者_如何学运维

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 9 years ago.

Improve this question

How to check when i have HTTP GET and it's loading, it's waiting for something to happen, and when it happen i want to load NEW HTTP GET, and i want every time the HTTP GET is loaded to appear new HTTP GET. How can this happen , is there some kind of listener for the get or trick ?

HERE IS SOME KIND OF EXAMPLE

$.get('url', function(data1) {
  // here i want i that get with data1 is loadded, to load a new one, and every time when the get loads, i want to appera new get.
});


If you mean jQuery .get():

$.get('/url1', function(data1) {
    $.get('/url2', function(data2) {
        ...
    });
});

Recursive call:

function doGet(prevData)
    $.get('/url1', function(data) {
        // if(conditionToStop) 
        //  return;

        doGet(data);
    });
}

doGet(null);

NOTE: Since the function is invoked inside a callback function this is not the same as calling the function inside itself. This is not true recursion.


Send the HTTP Get Request to the server and return the Json (store the status of the action).Check the Json value at client side if it is true then send the another request(GET).

For - example

$.post(url, sr, function (data) {
  if (typeof data == "object") {
     if (data.Status) {
        // Send another request
     }
     else {
       // Show the Message if action is not completed
      }
  }
  else {
          // Show Error Message
  }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜