getjson() {
const headers = {
"Access-Control-Allow-Origin":"https://semi-quantitative.com/wobi/json_test/server.php",
"origin":"http://localhost:8100/home"
}
let requestUrl = `${this.baseUrl}`;
return this.http.get(requestUrl, { headers: headers }).toPromise();
}
getjson2() {
let requestUrl = `${this.baseUrl}`;
return this.http.get(requestUrl).toPromise();
}
postjson2() {
const headers = { 'content-type': 'application/json' }
const body = this.jsonpostdata;
this.http.post(this.baseUrl, body, { 'headers': headers }).subscribe(
(response) => console.log(response),
(error) => console.log(error)
);
}
postjson2() {
var parameter = { title: 'Angular POST Request Example' };
const headers = { 'content-type': 'application/json' };
const body = this.jsonpostdata;
this.http.post(this.baseUrl, parameter, {headers: headers} ).subscribe(data => {
console.log(data);
});
}
postjson() {
const headers = { 'content-type': 'application/json' }
const body = this.jsonpostdata;
console.log(body)
return this.http.post(this.baseUrl, body, { 'headers': headers })
}