here is my code
I’m trying to insert data into the db Values are properly inserted into db but nothing show in respose
this.http.post(“http://www.domian.com/multiplefield/insert.php”,
JSON.stringify(this.post_to_server)).subscribe(data => {
let server = data.json();
try to place few console.log and see first if data holds anything.
data=>{
console.log('data: ",data);
let server = data.json();
console.log('Server: ",server);
.
.
.
}
this.http.post("http://www.mydomain.com/multiplefield/insert.php",JSON.stringify(this.post_to_server))
.subscribe(data => {
console.log("data",data)
let server = data.json();
console.log("Serve",server);
}, error => {
// Error getting the data
console.log(error);
});
but
console.log(error)
showing this error Object { _body: error, status: 0, ok: false, statusText: "", headers: {…}, type: 3, url: null }
how can i fixed that?
please help me
The error code show status as 0. A normal response from HTTP call should be 200.
What do you get if you call the http://www.mydomain.com/multiplefield/insert.php directly?
Can you check on the server side, what the insert.php product?
If you run it using ‘ionic serve’, you can use tcpdump to trace the communication.
Create a dummy php call that always return a valid results with status 200.
Use this one in your ionic this.http.post call, and see if you are getting the valid results.
( Don’t try to debug both backend and frontend at the same time ).