如何在json中返回字符串?

I have am using ajax to retun a array [[int,string],....] in index.json.

Here is my index.json

<%= @custom_fields.map {|e| [e.id ,e.name] }.to_json%>

and that is my ajax requiest

 $.get("/categories/" + (categoryId) + "/custom_fields.json", {}, function(data) {
        console.log(data);
      });

console.log prints nothing.

It work almost fine, cause in server log( when i use raise ....inspect) I have

("[[17,\"\\u0411\\u0440\\u0435\\u043d\\u0434\\u044b\"]]")

It have normal id , but my string value "name" is encoded(I think so). What I am doing wrong. String is in Russian language, maybe cause of this I have that problem? Thanks in advance

You are saying you have json in index.json and in $.get request you have specified custom_fields.json. Is this correct?

There are few steps to debug this type of issue.

  • If you are using Firefox browser you can use Firebug to monitor the XHR calls.
  • If you are using Chrome you can use its built in developer tool to monitor the XHR calls.
  • You can determine whether the call is being made. If yes then what is the raw response from the XHR call.