Guest User

Untitled

a guest
May 26th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. function stateChanged5()
  2. {
  3.  
  4. if (request5.readyState==4)
  5. {
  6. document.getElementById(displayElem).innerHTML=request5.responseText;
  7. }
  8. else
  9. {
  10. document.getElementById(displayElem).innerHTML="";
  11. }
  12. }
  13.  
  14. var counter = 0;
  15.  
  16. function makeRequest() {
  17. var xhr = // yada yada yada, get your XmlHttpRequest instance
  18. xhr.onreadystatechange = function() {
  19. if(this.readyState == 4) {
  20. // Do whatever, based on the counter variable
  21. counter += 1
  22. if(counter < 5)
  23. makeRequest();
  24. }
  25. else {
  26. // Do whatever, based on the counter variable
  27. }
  28. }
  29. xhr.open();
  30. }
Add Comment
Please, Sign In to add comment