Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Error while trying to post data into my local server

$
0
0

@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: null

Find 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

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



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