问题
I am trying to build the jstree menue based on xml file. My code is this:
$("#div").jstree({
"xml_data" : {
"ajax" : {
//"url": "jstree.xml"
"url": "http://192.168.101.1/xml/jstree.xml"
},
"xsl" : "nest"
},
"plugins" : ["themes", "xml_data", "ui","types"]
When the file is local as stated above followed by //, it works. If I tried to access the xml file via http call, it does not work. Any ideas? I really like to call the xml file via http since the file will be updating all the time.
回答1:
First make sure that http://192.168.101.1/xml/jstree.xml
actually returns the xml data. Also, according to the Xml data plugin, the url
parameter argument needs to be in quotes:
$("#div").jstree({
"xml_data" : {
"ajax" : {
//"url": "jstree.xml"
"url": "http://192.168.101.1/xml/jstree.xml"
},
"xsl" : "nest"
},
"plugins" : ["themes", "xml_data", "ui","types"]
来源:https://stackoverflow.com/questions/11957646/building-jstree-menu-based-on-xml