AJAX request doesn't work in IE (url encoding problem)
The good old Internet Explorer. It's full with surprises. I just fixed a bug happening only in IE. Everything works just great in every other browser.
I have a simple mobile site, which makes Ajax requests to an external REST API. Some part of the application works, but others not. I noticed that the problematic requests contain JSON. I.e. something like:
In Google Chrome, the actual request string looks like that:
The backend understand the query, parses it and returns a proper result. However, without correct url encoding the things are not working.
During the url preparation I replaced
url += JSON.stringify(parameter);
url += encodeURIComponent(JSON.stringify(parameter));
And the problem is fixed. Now even the crappy IE works.