Hi i will try to explain my issue. I have a login page and i can send data to php by this code
this.postPvdr.postData(body, 'http://www.website.com/login.php').subscribe((data) =>{
var alertbox = data.msg;
if (data.success) {
this.storage.set('session_storage', data.result);
this.navCtrl.setRoot(HomePage);
this.login_error_msg = "login success";
}
else {
this.login_error_msg = alertbox;
}
});
but i try to check user info when auto login but i get corse error with this code
this.storage.get('session_storage').then((res)=>{
if(res == null){
this.rootPage = LoginPage;
}else{
let body = {
usernamedata : res.pb_username,
};
this.postPvdr.postData(body, 'http://www.website.com/user_login_time.php').subscribe((data) =>{
if (data.success) {
console.log("success");
this.rootPage = HomePage;
this.logged_username = res.pb_username;
}
else {
console.log("unsuccess");
}
});
}
});
as you see i am using same code for posting data to php. but when login page posting it works perfect but when i check to login info it gives CORS errors.
this is my error
Access to XMLHttpRequest at 'http://www.website.com/user_login_time.php' from origin 'http://localhost:8100' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
is there any idea for this issue?