@emiljenson wrote:
I created a sample registration form and tried to insert data into local database ( am using php for server side ) but i got the following error
XMLHttpRequest cannot load http://localhost/manager/managerApi.php?key=register. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.ERROR Error: Uncaught (in promise): Response with status: 0 for URL: nullFind below my code that i wrote in the provider :
postData(data,key) { return new Promise((resolve,reject) => { let headers = new Headers(); this.http.post(baseUrl+key,JSON.stringify(data),{headers:headers}).subscribe(res => { resolve(res.json()); },(err) => { reject(err); }); }); }
Posts: 1
Participants: 1