Ajax post request jump page, ajaxpost request jump
Recently, due to the company's requirements, ajax post requests are required to jump to the interface. I searched the internet for information, and almost all of them use Windows. location. but the request parameters are exposed in the address bar of the Request page. This is not safe.
$. Post (url, {method: "regist", userName: $ nameEle. val (), email: $ emailEle. val (), password: $ passwordEle. val ()}, function (data) {// successful registration page Jump, window. location. href = ".. /yiliaoqixie/login.html? Name = "+ $ nameEle. val ();});
Therefore, we can only think of using form for post submission.
<Form method = "post" action = "action" id = "fm"> </form> $. post (url, {method: "regist", userName: $ nameEle. val (), email: $ emailEle. val (), password: $ passwordEle. val ()}, function (data) {// after successful registration, the page jumps, var fm = document. getElementById ("fm"); fm. submit ();});
The above is the Ajax post request jump page introduced by the editor. I hope it will help you. If you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!