Home > Web Front-end > JS Tutorial > Ajax post request jump page

Ajax post request jump page

亚连
Release: 2018-05-23 10:16:01
Original
2254 people have browsed it

This article mainly introduces the relevant information of Ajax post request jump page. It is very good and has reference value. Friends who need it can refer to it.

Recently, due to company needs, ajax post request and jump are needed. I switched interfaces and searched for information on the Internet. Most of them are processed using window.location.href, but the request parameters will be exposed in the address bar of the request page, which is unsafe.

$.post(
url,
{method:"regist",userName:$nameEle.val(),email:$emailEle.val(),password:$passwordEle.val()},
function(data) {
//注册成功页面跳转,
window.location.href ="../yiliaoqixie/login.html?name="+$nameEle.val();
}
);
Copy after login

Therefore, I can only think of post submission through the form form.

<form method="post" action="action" id="fm">
</form>
$.post(
url,
{method:"regist",userName:$nameEle.val(),email:$emailEle.val(),password:$passwordEle.val()},
function(data) {
//注册成功页面跳转,
  var fm=document.getElementById("fm");
  fm.submit();
}
);
Copy after login

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Ajax submission form page refreshes quickly

Ajax opens a new window and is blocked by the browser Two solutions to interception

ajax implements asynchronous file or image upload function

##

The above is the detailed content of Ajax post request jump page. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template