php

$data = array('name' => $name, 'price' => $price); $data = json_encode($data); print ($data); 

js $ .ajax ({

  type:'get', url: '/ajax/items_info.php', //dataType: 'json', cache: false, data:{'id':$item_id}, response:'text', success:function (data) { //jQuery.parseJSON(data); console.log(data); } }); 

All of this is on bitrix, if it matters at all) when I transmit just strings of the type $ name - Russian characters are typed. The array is u0412 \ u0435 \ u043d. Commented code does not help much, gives errors.

  • try adding index.php at the top of the page or whatever you have there setlocale (LC_ALL, 'ru_RU.utf8'); Header ("Content-Type: text / html; charset = UTF-8"); - axmed2004
  • 3
    Use the JSON_UNESCAPED_UNICODE in json_encode() . - Visman
  • It was cool, but it didn't help - Dima Rashevskiy
  • one
    JSON_UNESCAPED_UNICODE worked. super! thank. - Dima Rashevskiy
  • success: function (data) {console.log (data [0]); - I can not display the first element of the array in this way, what's the matter? - Dima Rashevskiy

0