I have this code:
$.ajax({
dataType: \'text\',
url: \'/_/js/answers.json\',
type: \"GET\",
success: funct
Try changing dataType to JSON:
$.ajax({
dataType: 'JSON',
url: '/_/js/answers.json',
type: "GET",
success: function (data) {
alert(data);
alert(data.code);
var result = JSON.parse(data);
var hey = JSON.parse('{"code": 123}');
alert(hey.code);
alert(result.code);
},
error: function () {
alert("code not found");
}
});