Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function stateChanged5()
- {
- if (request5.readyState==4)
- {
- document.getElementById(displayElem).innerHTML=request5.responseText;
- }
- else
- {
- document.getElementById(displayElem).innerHTML="";
- }
- }
- var counter = 0;
- function makeRequest() {
- var xhr = // yada yada yada, get your XmlHttpRequest instance
- xhr.onreadystatechange = function() {
- if(this.readyState == 4) {
- // Do whatever, based on the counter variable
- counter += 1
- if(counter < 5)
- makeRequest();
- }
- else {
- // Do whatever, based on the counter variable
- }
- }
- xhr.open();
- }
Add Comment
Please, Sign In to add comment