building jstree menu based on xml

☆樱花仙子☆ 提交于 2019-12-12 00:19:02

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!