I pass data with escape() function [escape(output)]. see in bellow snippet
Passed such string to ajax call:
Klikkaa lisätäksesi
tekstiä
tekstiä
and get result of such string
Klikkaa lis�t�ksesi
teksti�
teksti�
what's problem occure in this script
var callBackActUrl = "dvk.eirikvae.aum"
var textdata = "text="+escape(output);
jQuery.ajax({
type: "POST",
url: callBackActUrl,
data: textdata,
cache: false,
success:function(responseText){
alert(responseText);
}
});
Solution :
I had read lot of artical on google and find solution for. I passed data in ajax using escape function, we replaced escape() function with
encodeURIComponent() and it is working proper.
var textdata = "text="+encodeURIComponent(output);
This method will encode certain chars that would normally be recognized as special chars for URIs.
No comments:
Post a Comment