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

How to operate Ajax post request to jump page

php中世界最好的语言
php中世界最好的语言Original
2018-04-02 17:25:376605browse

This time I will bring you how to operate Ajaxpost requestJump page, what are the precautions for Ajax operation post request to jump page, the following is a practical case, let's go together take a look.

Recently, due to company needs, I need to request ajax post and jump to the interface. I searched for information online and found that window.location.href is almost used to handle it, but the request will be exposed in the address bar of the request page. Parameters, this is not safe.

$.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, the only way to think of post submission is through the form form.

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

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Asynchronous file or image upload ajax

Why does garbled code appear when ajax passes json

The above is the detailed content of How to operate Ajax post request to 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