I am making a bookmarklet that uses $.getJSON()
to transfer data from browser (different domain) to server and back. and I am having several issues with url encoding.
When I send the data to php I use encodeURIComponent()
and decodeURIComponent()
the response. in the php i do no encoding or decoding.
In many situation this works fine in cases of "/ & etc.
However if i have ',' or % or some other character, when i get the response and it tries to decodeURIComponent
. i get the following error :URIError: malformed URI sequence
Is there a better way to encode url ?
Thanks