I have a POSTS AJAX page on the server, and often the data will be Unicode.
This works most of the time, but it seems like it breaks sometimes and I canβt find the answer anywhere. I use encodeURI, but I'm not sure if this is correct.
Here is a sample code:
$.ajax({ type: "POST", url: "SomePage.php", data: "val1=" + encodeURI(unicodeVariable) + "&presentation=" + encodeURI(someUnicodeVariable), success: function(msg){ } });
I assume that sometimes the Unicode character happens and that violates it.
What is the correct way to encode Unicode to invoke AJAX using jQuery?
Thanks.
source share