easyui tree如何获取mvc中Controller的代码拼接数据
答案:2 悬赏:40
解决时间 2021-04-18 07:40
- 提问者网友:冥界祭月
- 2021-04-17 22:52
mvc中Controller的代码拼接数据用 public string GetMenuData() {string json=""; ...... return json; },或 public ActionResult GetMenuData() { ......return Json(json, JsonRequestBehavior.AllowGet); }在前台view中用 $("#treeMenu").tree( { url: "/PermissionInfo/GetMenuData",}来接收,页面不显示任何内容,但将页面GetMenuData() 生成的代码复制到js中data= [{ "id": "1", "text": "系统设置", "attributes": { "url": "", "pId": "0" }, children: [{ "id": "19", "text": "Web设置", "attributes": { "url": "", "pId": "1" } }] }, { "id": "4", "text": "2管理", "attributes": { "url": "", "pId": "0" }, children: [{ "id": "5", "text": "报名模块", "attributes": { "url": "", "pId": "4" }, children: [{ "id": "13", "text": "1管理", "attributes": { "url": "", "pId": "5" } }, { "id": "18", "text": "代表", "attributes": { "url": "", "pId": "5" } }, { "id": "20", "text": "3管理", "attributes": { "url": "", "pId": "5" } }] }, { "id": "6", "text": "查询模块", "attributes": { "url": "", "pId": "4" } }, { "id": "7", "text": "模块", "attributes": { "url": "", "pId": "4" } }, { "id": "8", "text": "处理模块", "attributes": { "url": "", "pId": "4" } }, { "id": "9", "text": "统计模块", "attributes": { "url": "", "pId": "4" } }] }],用 $("#treeMenu").tree( { data: data,},则页面tree正常显示 ,是什么原因? easyui tree应如何获取mvc中Controller的代码拼接数据 ?说明:GetMenuData() 生成的代码应没有问题
最佳答案
- 二级知识专家网友:狙击你的心
- 2021-04-18 00:31
在tree的url:'/controllername/GetMenuData'
我的配置“{controller}/{action}/{id}”
具体要看你的mvc路由配置方式
我的配置“{controller}/{action}/{id}”
具体要看你的mvc路由配置方式
全部回答
- 1楼网友:湫止没有不同
- 2021-04-18 00:52
我。。知。。道
加。。我。。私。。聊
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯