Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.73 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <title>XMLHttpRequest Test</title>
  5.     <script>
  6.         function sendRequest(url, method, async) {
  7.             var xhr = new XMLHttpRequest();
  8.             xhr.open(method, url, async);
  9.  
  10.             xhr.onload = function() {
  11.                 console.log('Response from CORS request ' + xhr.reponseText);
  12.             };
  13.  
  14.             xhr.onerror = function() {
  15.                 console.log('Woops, there was an error making the request.');
  16.             };
  17.  
  18.             xhr.send();
  19.         }
  20.  
  21.         for(var i = 0; i < 25; i++) {
  22.            sendRequest('https://cors-test.appspot.com/test', 'GET', false);
  23.        }
  24.    </script>
  25. </head>
  26. <body>
  27.     <h1>Page Title</h1>
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement