我的网络服务中存在问题:
这是我现在的状态:
我的问题是: CORS是否将POST方法带到服务器?
let url = 'https://someurl.url';
let username : string = 'username';
let password : string = 'password';
let headers = new Headers();
headers.append("Authorization", "Basic " + btoa(username + ":" + password));
headers.append("Content-Type", "application/json; charset=UTF-8");
headers.append("cache-control", "no-cache, private");
let dataa =
{
"paket_aqiqoh" : [{"id_paket":2,"jumlah":22}],
"nama_pemesan" : "coba",
"nama_anak" : "nama anak",
"no_hp" : "143432432",
"email" : "user@mail.com",
"address" : "Jalan Bukit Dago Utara IV, Dago, Bandung City, West Java, Indonesia",
"lat" : -6.8696385,
"long" : 107.61863990000006,
"tanggal_kirim": "2018-06-11 20:06",
"id_user" : "web_user",
"device_id" : "Web_user",
"kota" : "Bandung",
"notes" : "Ini Notes",
"discount_code": "BANDUNGAQIQAH",
"nama_ayah" : "nama_ayah",
"nama_ibu" : "nama_ibu"
};
var body = JSON.stringify(dataa);
console.log(body)
return this.http.post(url,body, {headers: headers})
.subscribe(
(res)=>{
console.log("Sucsses",res)},
err => {
console.log('Error', err);
});
}