mysql - jQuery post serialize russian -
i trying post data database , campaigns run in 6 languages, 1 being russian , unable handle cyrillic text.
the dtb setup utf8 last campaign used russian, jquery one.
$(document).ready(function () { $("#form").submit(function () { //use forms id var str = $(this).serialize(); $.ajax({ type: "post", url: "includes/postdata.php", data: str, success: function (msg) { if (msg == 'ok') { //alert('success'); $('#thankyou').delay(100).fadein(350); } else { result = msg; console.log(msg); } } }); return false; }); });
the error getting "incorrect string value: '\xc3\x91\xc2\x80\xc3\x91...'"
tried editing post data
$country = utf8_decode($_post['country']);
which posts, ?'s in dtb.
how jquery correctly handle post fur russian. appreciated.
after trial, error, forum , plenty of google found solution. wrap decodeuri around str variable.
var str1 = $(this).serialize(); var str = decodeuri(str1);
that fixes uri string jquery parses on post data
Comments
Post a Comment