Values are properly inserted into db but nothing show in respose

here is my code
I’m trying to insert data into the db Values are properly inserted into db but nothing show in respose“”,
JSON.stringify(this.post_to_server)).subscribe(data => {
let server = data.json();

    let respose =;

try to place few console.log and see first if data holds anything.
console.log('data: ",data);
let server = data.json();
console.log('Server: ",server);

no. data is not holding anything"",JSON.stringify(this.post_to_server))
      .subscribe(data => {
      let server = data.json();

      }, error => {
        // Error getting the data

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 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.

i’m call the api directly
below is my php code

     // Allow from any origin
    if (isset($_SERVER['HTTP_ORIGIN'])) {
        header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
        header('Access-Control-Allow-Credentials: true');
        header('Access-Control-Max-Age: 86400');    // cache for 1 day

            header("Access-Control-Allow-Methods: GET, POST, OPTIONS");         



$postdata = file_get_contents("php://input");  
        $obj = json_decode($postdata,TRUE);

        foreach($obj as $key)
                $query = "insert into test (name,address,doc_contact) values ('".$key['name']."','".$key['address']."','".$key['contact']."')";
                $result = mysqli_query($con,$query);    //execute $query with mysqli_query

        if($result) {
        $data = [ 'Status' => '1'];

    } else {

    echo json_encode($data);


Create a dummy php call that always return a valid results with status 200.
Use this one in your ionic call, and see if you are getting the valid results.
( Don’t try to debug both backend and frontend at the same time ).