Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49237

HTTP Request ends in Status:0 for URL: null

$
0
0

@HansMartin wrote:

Hi guys, hope you can help me out…

I run my app with “ionic serve --lab” and want to try a simple login. With firebase there is no problem but if I want to use mysql + php, the http request always fails. Since I haven’t an own webserver I use one from https://de.000webhost.com/.

So here is the code of the http part:

createEntry(username: string, password: string, email: string) {
    let headers: any = new HttpHeaders({
        'Content-Type': 'application/json',
        'Access-Control-Allow-Origin': '*',
        'Access-Control-Allow-Headers': 'X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method',
        'Access-Control-Allow-Methods': 'GET, POST, OPTIONS, PUT, DELETE'
        }),
        options: any = { "key": "create", "username": username, "password": password, "email": email },
        url: any = this.baseURI + "manage-data.json";

    this.http.post(url, JSON.stringify(options), headers).subscribe((data : any) => {
        // If the request was successful notify the user
        this.sendNotification(`Congratulations ${username} was successfully added`);
    }, (error : any) => { this.sendNotification(error); });
  }

The parameters are the data which comes from the submitted form. The url for the http request looks like this: https://wikiloopsapp.000webhostapp.com/manage-data.php

And like the title says it, the request fails and I get an error: Status:0 for URL: null…

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49237

Trending Articles



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