JQuery AJAX Call with Unicode. Proper way to POST Unicode data? -


I have a page that posts AJAX to the server, and often the data will be unicode.

It works most of the time, but it appears that sometimes it is breaking and I can not get the answer anywhere. I'm using encoder, but I'm not sure it's right.

Here is an example of code:

  $ .ajax ({type: "POST", Url: "SomePage.php", Data: "val1 =" + Encodeuri (unicode-navable) + "& amp; Presentation =" + someUnicodeVariable, success: function (msg) {}});  

I think what's happening sometimes in a Unicode character is a & amp;

Thank you.

here A good way to compare all the encoding methods.

Finally, the encodurac component () method should be used in most cases when a component of a URI is encoded, this method will encode some characters Which will normally be identified as a special character for the URI so that several components can be included. Note that this method does not encode 'characters because it is a valid character within the URI.

EncoderImpany () encode also "& symbol:

  encoder (" & amp; "); //" & amp; encodeurIComponent ( " 

Or you can just change this line:

  Data:" val1 = "+ Encodeuri (Unicode variables) +" & amp; Presentity = "+ someUnicodeVariable,  

In an object:

  Data: {val1: unicodeVariable, presentation: someUnicodeVariable}  < / Ex> 

and jQuery will automatically ensure that the data is encoded, using encodermonent ().


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -