【问题标题】:jeasyui ajax help needed需要 jeasyui ajax 帮助
【发布时间】:2016-03-14 04:14:29
【问题描述】:

我正在使用 jeasyUI 并希望实现一个树形文件网格。我的代码可以很好地从我的 mysql 数据库中检索项目(树),显示它并让它被拖放和拖动,但我不知道如何实现 AJAX 部分以在重新排序项目时上传更改。我包含了示例代码,但它不起作用。老实说,我是 AJAX 的新手,尽管我过去曾使用过它。谁能指出我应该做的正确方向。我知道 PHP、Mysql,目前正在学习 JQUERY 和 Javascript。

    <script>
    $(function(){
        $('#tt2').tree({
            dnd: true,
            url:'sql/tree2_getdata.php',                
            onClick: function(node){
                $(this).tree('beginEdit',node.target);
            },
            onDrop: function(targetNode, source, point){

                var targetId = $(target).tree('getNode', targetNode).id;
                $.ajax({
                    url: 'sql/tree2_putdata.php',
                    type: 'post',
                    dataType: 'json',
                    data: {
                        id: source.id,
                        targetId: targetId,
                        point: point
                    }
                }); 
            }
        }); 
        });
</script>
<h2>File List</h2>
<ul id="tt2"></ul>

【问题讨论】:

  • 如果你提供你的 tree2_putdata.php 代码真的很有帮助

标签: jquery ajax jquery-easyui


【解决方案1】:

试试这样的

$.ajax({
                    url: 'sql/tree2_putdata.php',
                    type: 'post',
                    dataType: 'json',
                    data: {
                        id: source.id,
                        targetId: targetId,
                        point: point
                    },
                    success: function(data){
                      $(this).tree('reload');
                    }
                }); 

并确保更新tree2_putdata.php 文件中树的顺序

希望对你有帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-28
    • 2020-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多