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

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -