I am making ajax call to the database and every word that is saved in cyrillic is returned like: "[\"\\u043a\\u043d\\u0438\\u0433\\u0430\"]"
. How can i prevent this ? This line of code should be книга
. This is my ajax:
$.ajax({
method: "POST",
url: '/admin/site/searchwords',
/*contentType: "application/json; charset=utf-8",*/
data: {
query: string
},
success: function (data) {
var data = JSON.stringify(data);
console.log(data)
return false;
}
});
I commented contentType
because it gives me error with it:
PHP Notice 'yii\base\ErrorException' with message 'Undefined index: query'
. Maybe i missunderstood something with them ajax requests. I took a look at another answers but still don't understand how to fix it. The framework is Yii2
(if that matters somehow).Thank you in advance!