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

Apostrophe in http request

$
0
0

Hi everyone, I’ve got a problem with my application developed with ionic 3.
When I send a string that contains apostophe to my server with ionic-native-http plugin get me back an error. My server was made in php and when it receives the data I use this function for accept the apostrophe:

mysqli_real_escape_string($conn,$_GET['param']); 

With postman it works fine, but if I send the string with the application throw me an exception.
The function in the application is this:

inviaDati(){
    this.http.get('https://domain.com', {req: 'regDitta', param: "the ' string"}, {})
    .then(data => { //not here
      if(data.data == 0){ 
        alert("registrazione effettuata")
      }else{
        alert("errore");
      }
    },
    error => alert("error")) // it always gives me back this error;
  }

I have to encode the string? How can I do that?
Thank you all,
Elia

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles



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