Guest User

Untitled

a guest
Jan 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. <html>
  2. <head></head>
  3.  
  4. <body>
  5. <script language="javascript">
  6. var xmlhttp = false;
  7.  
  8. // If XMLHttpRequest function does not exist (certain versions of IE,
  9. // or if native XMLHTTP support is disabled under the security settings),
  10. // create it to return the activex equivalent.
  11. if(!window.XMLHttpRequest) {
  12. window.XMLHttpRequest = function() {
  13. // For maximum compatibility, try all versions.
  14. var xml_versions=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0",
  15. "MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
  16. for(var x = 0;x < xml_versions.length; x++) {
  17. try {
  18. return new ActiveXObject(xml_versions[x]);
  19. } catch (e) {}
  20. }
  21. return false;
  22. }
  23. }
  24.  
  25. if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  26. try {
  27. xmlhttp = new XMLHttpRequest();
  28. } catch (e) {
  29. xmlhttp = false;
  30. }
  31. }
  32.  
  33. if(xmlhttp) {
  34. /* .readyState = 0 Uninitialized
  35. .readyState = 1 open() Called
  36. .readyState = 2 send() Called
  37. .readyState = 3 recieving data, .responseText holds partial data in FF
  38. .readyState = 4 data finished */
  39. xmlhttp.onreadystatechange = function() {
  40. if(xmlhttp.readyState == 4) {
  41. alert("RESPONSE HEADERS:\n\n" + xmlhttp.getAllResponseHeaders());
  42. alert("STATUS:\n\n" + xmlhttp.status);
  43. alert("RESPONSE TEXT:\n\n" + xmlhttp.responseText);
  44. }
  45. }
  46.  
  47. xmlhttp.open("GET", "/?var1=val1&var2=val2");
  48. xmlhttp.send(null);
  49.  
  50. /* If you want to POST data to recieve_data.php instead
  51. var post_data = 'var1=' + encodeURIComponent('asj$@#&&?') + '&var2=val2';
  52. xmlhttp.open("POST", "recieve_data.php");
  53. xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  54. xmlhttp.setRequestHeader('Content-length', post_data.length);
  55. xmlhttp.send(post_data); */
  56. }
  57. </script>
  58.  
  59. </body>
  60. </html>
Add Comment
Please, Sign In to add comment