jquery - jstree AJAX doesn't work, has a Syntax error: unrecognized expression for the json -
i use jstree api request json data ajax, doesn't work, , shows me error:
error: syntax error, unrecognized expression: {"results":[{"id":"a","parent":"b","text":"hello","icon":"something..."}, {"id":"b","parent":"#","text":"world","icon":"somethingelse..."}]}
it seems json right format, ajax cannot recognize it.
my ajax code this:
$('#jstree').jstree({ 'core' : { 'data' : { 'url' : 'loadjstree.php', 'data' : function (node) { return { 'id' : node.id }; } }, } });
and api demo:link demo
why doesn't work? cound me? thank you!
have tried removing "results" object?
{"results":[{"id":"a","parent":"b","text":"hello","icon":"something..."}, {"id":"b","parent":"#","text":"world","icon":"somethingelse..."}]}
to
[{"id":"a","parent":"b","text":"hello","icon":"something..."}, {"id":"b","parent":"#","text":"world","icon":"somethingelse..."}]
the json structure jstree - http://www.jstree.com/docs/json/
you try adding 'datatype': 'json'...
'url' : 'loadjstree.php', 'datatype': 'json', 'data' : function (node) { return { 'id' : node.id }; }
i read no longer required helped me.
Comments
Post a Comment