在ajax表单注入后重新加载DOM

时间:2012-02-14 01:09:55

标签: jquery ajax dom jquery-selectors

我尝试过类似的问题但没有用。

我的问题是如何在发出ajax请求后重新加载DOM? 它不是关于事件委托的问题,而是关于jquery选择器的问题。

样品:

editUser : function(){
            var editItem = $("a.edit");


            editItem.on('click', function(e){
                e.preventDefault();

               //click the users tab & the edit tab
                var usersjq = $("li#users-jq");
                usersjq.find("a").eq(0).click();
                $("ul.tabs").find("a").eq(2).click();


                var uid = $(this).attr('id').split('_')[1];
                $(".three #users-edit").empty();

                $(".three #users-edit").load(BASE_PATH + 'users/admin/users/edit/' + uid, function(){
                   //loads a form with id of #form-users-edit

                }, 'html');



            });
        },
formEditUsers : function(){

            //#form-users-edit is not selectable

            //all of these just return jQuery ( ) 
            console.log($(".three #users-edit").find("#form-users-edit"));
            console.log($(document.forms));
            console.log($("form#form-users-edit"));

        }

问候。

1 个答案:

答案 0 :(得分:0)

formEditUsers()传递给ajax成功回调似乎工作正常。