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.jsonand in$.getrequest you have specifiedcustom_fields.json. Is this correct?There are few steps to debug this type of issue.
XHR calls.
monitor the XHR calls.
the raw response from the XHR call.