Advertisement
Guest User

Untitled

a guest
Jun 12th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const http = new XMLHttpRequest();
  2. const params = 'frashnum=&action=login&Frm_Logintoken="+results+"&Username=admin&Password=test';
  3. const url = 'http://localhost/XHR/';
  4. var response;
  5. http.open('GET', url, false);
  6. //Send the proper header information along with the request
  7. http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  8.  
  9.  
  10.  http.onreadystatechange = function ()
  11.     {
  12.         if(http.readyState === 4)
  13.         {
  14.             if(http.status === 200 || http.status == 0)
  15.             {
  16.                 let str = (http.responseText);
  17.                 let pattern =/\bgetObj\("Frm_Logintoken"\)\.value = "([^"]+)";/;
  18.                 let results = str.match(pattern)[1];
  19.                 response = results;
  20.             }
  21.         }
  22.     }
  23. http.send(params);
  24. console.log(response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement