Код: Выделить всё
if(Yii::$app->request->isAjax && $user){
$json = json_encode(Yii::$app->request->post());
$decode = json_decode($json, true);
return $decode;
}
Код: Выделить всё
jQuery.ajax({
url: "index",
type: "POST",
data: {title : val},
success: function(data) {
$('h1').remove();
$('#privetstvie').prepend('<h1>'+data.title+'</h1>');
jQuery('#privetstvie').show();
}
Когда в контроллере вот так:
Код: Выделить всё
if(Yii::$app->request->isAjax && $user){
//$json = json_encode(Yii::$app->request->post());
//$decode = json_decode($json, true);
return json_encode(Yii::$app->request->post());
}
data: "{"title":"\u0414\u0430!? "}"
Как вернуть нормальную расдекодированную строку с русскими словами, в данном случае здесь должно отобразиться слово "Да!?"