1

我正在使用示例 -

http://codemyne​​.net/articles/Populating-Treeview-with-checkboxes-using-MVC3Razor-Jstree-Jquery.aspx?visitid=149&type=2

我想将所选节点的值传递给控制器​​。文章的作者正在消息框中显示值;我想 在同一页面的TextBox中显示所选项目的文本或 id 或将其传递给控制器​​。任何人都可以帮我做吗?

谢谢,

4

1 回答 1

0

试试这个(未经测试):

function getChecked(){
    divId = [];

    $("#onflycheckboxes").jstree("get_checked", null, true).each(function () {
       divId.push(this.id);              
    });

    $.ajax({
       url: "/MyController/Action",
       type: "POST",
       dataType: "json",
       data: {divIds: divId},
       contentType: "application/json charset=utf-8"
    })
}

MVC 控制器 ( MyControllerController.cs)

[HttpPost]
public ActionResult Action(object[] divIds=null)
{
   //break here and view the results of divIds.
   return Json("success");
}
于 2013-05-14T14:45:12.323 回答