I'm getting issue in angular 4 .... I am building hybrid app using ionic 3.
I have to use php as server side language for APIs, I am having issue in posting variables to http.post() request ...
variables are not passed to php file.
Method I'm using to call API from home.ts is:
var json = {var1: 'test'};
var params = 'json='+json;
let headers = new Headers();
headers.append('Content-Type', 'application/json');
http.post("http://example.com/infoarray.php", params, headers ).subscribe (re => {
console.log(re)
})
I'm able to get response from API just fine but the problem is I can't pass the value of variable 'var1' to my API on infoarray.php I'm encoding the request to json ... but didn't get variables