Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49142

Trying to use native http but it's not working

$
0
0

@aditya_1027 wrote:

Below is my code. It’s just returning undefined:

    this.http.post(
      'https://abcd.com/request.api',
      JSON.stringify(requestData),
      {
        'Content-Type': 'application/json'
      }
    )
    .then(data => {

      console.log(data.status);
      console.log(data.data); // data received by server
      console.log(data.headers);

    })
    .catch(error => {

      console.log(error.status);
      console.log(error.error); // error message as string
      console.log(error.headers);

    });

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49142

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>