@asha4640 wrote:
My ts file function is
save() {
var link = ‘http://localhost/apicode/index.php/Login/addUser’;
var myData = JSON.stringify({name:this.registerForm.value.name,username: this.registerForm.value.username,password:this.registerForm.value.username});
console.log(myData);
this.http.post(link, myData)
.subscribe(data => {
this.data.response = data["_body"];
console.log(“success!”);
this.navCtrl.navigateForward(’/login’);
}, error => {
console.log(“Oooops!”);
});
}this codeigniter controller function
function addUser_post(){
$_POST = json_decode(file_get_contents('php://input'), true); $postdata = $this->input->post(); if(!$postData ){ $this->response("Enter complete user information to save", 400); }else{ $result = $this->login_model->add($postData); if($result === 0){ $this->response("Userinformation coild not be saved. Try again.", 404); }else{ $this->response("success", 200); } } }
It shows the error when i call the save function
Posts: 1
Participants: 1