2015-10-20 77 views
0

我使用的是jQueryI想与NODE_ID,如_type这是JSON如下图所示如何在AciTree jQuery插件的Ajax调用添加自定义查询参数

[{ 
    "id":"2",  
    "label":"Title for folder",  
    "branch":[],  
    "inode":true,  
    "open":false,  
    "icon":"folder",  
    "_type":"library" 
}] 

我一起发送自定义查询参数正与ajaxhook试图如下图所示

ajaxHook: function (item, settings) { 
    // the default implementation changes the URL by adding the item ID at the end  
    alert(this.itemData._type);  
    settings.url += (item ? this.getId(item) : '');  
} 

我不能用这个方法让我的自定义属性_type

回答

0

下面是正确的方式做到这一点:

ajaxHook: function (item, settings) { 
        // the default implementation changes the URL by adding the item ID at the end 
        if (item != null) { 
         var ItemData = this.itemData(item); 
         settings.url += (item ? this.getId(item) : '') + '&type=' + ItemData._type; 
        } 
       }, 
0

this.itemData是一个数组,因此或要么你就可以循环,或做类似:

alert(this.itemData[0]._type); 
+0

它不工作 – digi

相关问题