javascript - jQuery AJAX/getJSON unexpected token error -


when trying json file server so:

function getjson(completedfunction) {     $.ajax({         type: 'get',         url: 'export.json',         datatype: 'json',         success: function(data) {             treedata = data;             console.log(treedata);         },         error: function(data, textstatus, error) { console.log("getjson failed, status: " + textstatus + ", error: " + error); },         complete: function(data) { completedfunction(); }     }); } 

chrome shows error getjson failed, status: parsererror, error: syntaxerror: unexpected token c , firefox says getjson failed, status: parsererror, error: syntaxerror: json.parse: expected double-quoted property name @ line 34 column 49 of json data. not seem matter if put few lines above line 34 moving down, error stays there.

my json data has following form , drives d3 tree:

[{"id": 0,     "name": "some organization",     "children": [         { "id": 1,         "name": "jane doe" }     ] }] 

i put file through multiple json validators , of them claim valid json. file in smae directory js code.

what missing? code used work before edited bunch of things , apparently accidentally changed wrong thing.

edit:

the file produced php has yet written. right now, export.json file sitting there on server demo.

i checked network tab , firefox seems think file gets xml (with or without datatype). response same file minus quotes around name had double quotes around it.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -