基于xml构建jstree菜单 [英] building jstree menu based on xml

查看:133
本文介绍了基于xml构建jstree菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试基于xml文件构建jstree菜单.我的代码是这样的:

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"] 

当文件是上述本地文件,后跟//时,它将起作用.如果我尝试通过http调用访问xml文件,则无法正常工作.有任何想法吗?我真的很想通过http调用xml文件,因为该文件将一直更新.

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.

推荐答案

首先请确保http://192.168.101.1/xml/jstree.xml实际上返回了xml数据.另外,根据 Xml数据插件url参数参数必须用引号引起来:

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"] 

这篇关于基于xml构建jstree菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆