Home  >  Article  >  Web Front-end  >  Ajax post request jump page

Ajax post request jump page

亚连
亚连Original
2018-05-23 10:16:012204browse

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();
}
);

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();
}
);

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!

Statement:
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