Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const http = new XMLHttpRequest();
- const params = 'frashnum=&action=login&Frm_Logintoken="+results+"&Username=admin&Password=test';
- const url = 'http://localhost/XHR/';
- var response;
- http.open('GET', url, false);
- //Send the proper header information along with the request
- http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
- http.onreadystatechange = function ()
- {
- if(http.readyState === 4)
- {
- if(http.status === 200 || http.status == 0)
- {
- let str = (http.responseText);
- let pattern =/\bgetObj\("Frm_Logintoken"\)\.value = "([^"]+)";/;
- let results = str.match(pattern)[1];
- response = results;
- }
- }
- }
- http.send(params);
- console.log(response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement