Franco Manzur Franco Manzur - 2 months ago 12
Ajax Question

angularjs - url get encoded in ajax call

i got service which makes an ajax call (GET).

var _getMemeValues = function(category_id, attribute_id) {
return $http.get('/api/meme_​values?category_id='+category_id +'&​attribute_id='+attribute_id);
};


When i make that call the url get encoded like this.
http://localhost:8080/api/meme_%E2%80%8Bvalues?category_id=MLB1468&%E2%80%8Battribute_id=MLB1234

How can i solve this? I Tried converting it with toString(), decodeURIComponent but it didn't work

Answer

There is a control character(LRM) in your string

'/api/meme_​values?category_id='+category_id +'&​attribute_id='
here       ^                         and here ^

i.e after meme_ and before attribute_id= just remove it and you'll be fine.
This character usually comes from editors like ms word.

Comments