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

How to replace Special Characters with a Prefix for URI

$
0
0

@AaronRogers3 wrote:

Hi everyone,
Im new to Ionic and I have taken up a project from a girl who has recently left my work.
I have received a defect that when the user types in “N/A” to search for an order it breaks the URI when searching. A co-developer has suggested that replacing the “/” with “%2F” will fix this in the URI.

For a long term fix I would like to be able to read what the user has entered and if it contains any special characters then replace it with this prefix?

Here is some code I have:

 async getOrder() {
       if ( this.searchValue.length < 1) {
      console.log('search is empty');
      this.alertService.emptyInput();
    } else {
        /**
         * Setup loading controller
         */
        const loading = await this.loadingController.create({
          message: 'Searching..'
        });
        await loading.present();

              // Get access token from storage
         this.storage.get(ACCESS_TOKEN).then((token) => {
           console.log('token from storage: ', token);

           
           const urlOrderNo = this.apiUrl + 'ordersearch/' + this.searchValue;

Would anyone help me out! Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70764

Trending Articles



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