我正在使用跨平台的android(firebase攻击)和web(php作为服务器端),我只需要使用php将用户(firebase)的UID存储到mysql数据库中
由于安全原因,我想通过POST使用我使用重定向方法来获取php,因此我尝试$ .post ajax
我使用以下get方法
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
document.getElementById("user_div").style.display = "block";
document.getElementById("login_div").style.display = "none";
var user = firebase.auth().currentUser;
var io=user.uid;
var str="http://localhost/firebaseWebLogin/user.php?id="+io;
//window.alert(str);
window.location.replace(str);
if(user != null){
var email_id = user.email;
document.getElementById("user_para").innerHTML = "Welcome User : " + email_id;
}
} else {
// No user is signed in.
document.getElementById("user_div").style.display = "none";
document.getElementById("login_div").style.display = "block";
}
});
然后我尝试这种方法
我使用$.post
ajax
$.post( "test.php", { id: io } );
使用$.post( "test.php", { id: io } );
不会导致任何结果
有可行的方法吗?