<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <title>Данные формы</title> </head> <body> <form name="LoginForm" action="https://prostozaim.com.ua/login"> <input name="__RequestVerificationToken" type="hidden" value="KBJFK518pv_T9XaOTA8RbfVDxjXQkhfFIr3GFEmpt9d-ZNunk4rtDGYZ4GGWIILQiyKRlyZs548GLLe5H8c4rtNo9F9QUG1yTwZs-5UfZxg1"> <p><input name="loginEmail" id="LoginEmail"> <input type="password" name="LoginPassword" id="LoginPassword"></p> </form> <p><input type="submit" id="qw"></p> <div id="result"><div> <script> qw.onclick=function(){ var formdate = new FormData(document.forms.LoginForm); var xhr=new XMLHttpRequest(); xhr.withCredentials = true; xhr.open("POST", "https://prostozaim.com.ua/login", true); xhr.send(formdate); alert(xhr.responseText);}; </script> </body> </html>
It is necessary with the help of the Ajax post
request to authenticate at the specified URL from its form.
Tell me what is wrong? What is superfluous? Or how to do it?