Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. function initiate()
  2. {
  3.    document.getElementById("list").innerHTML = '<img src="loader.gif" />';
  4.    var xmlhttp;
  5.    if (window.XMLHttpRequest)  {// code for IE7+, Firefox, Chrome, Opera, Safari
  6.    xmlhttp=new XMLHttpRequest();
  7.    }
  8.    else  {// code for IE6, IE5
  9.     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  10.    }
  11.  
  12. xmlhttp.onreadystatechange=function()  {
  13.   if (xmlhttp.readyState==4 && xmlhttp.status==200)    {
  14.     document.getElementById("list").innerHTML = xmlhttp.responseText;  
  15.     }
  16.   }
  17.  
  18. xmlhttp.open("GET","scripts/fetchUsers.php",true);
  19. xmlhttp.send();
  20.  
  21. }
  22.  
  23. function submitUser(element)
  24. {
  25.   element.disabled = true;
  26.   element.value = "saving";
  27.   var user = document.getElementById("userName").value;
  28.  
  29.  
  30.    var xmlhttp;
  31.    if (window.XMLHttpRequest)  {// code for IE7+, Firefox, Chrome, Opera, Safari
  32.    xmlhttp=new XMLHttpRequest();
  33.    }
  34.    else  {// code for IE6, IE5
  35.     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  36.    }
  37.  
  38. xmlhttp.onreadystatechange=function()  {
  39.   if (xmlhttp.readyState==4 && xmlhttp.status==200)    {
  40.     if(xmlhttp.responseText!="")
  41.       alert(xmlhttp.responseText);
  42.      
  43.     document.getElementById("userName").value = "";
  44.     element.disabled = false;
  45.     element.value = "alright!"
  46.     initiate();
  47.     }
  48.   }
  49.  
  50. xmlhttp.open("GET","scripts/submitUser.php?user="+user,true);
  51. xmlhttp.send();
  52.  
  53.  
  54. }