亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        ajax回調(diào)函數(shù)中使用$(this)取不到對象的解決方法

        字號(hào):


            如果在ajax的回調(diào)函數(shù)內(nèi)使用$(this)的話,實(shí)踐證明,是取不到任何對象的,需要的朋友可以參考下
            代碼如下:
            $(".derek").each(function(){
            $(this).click(function(){
            var params = $(this).parent().serialize();
            var obj=$(this).parent().siblings("div#caskContent");
            var form=$(this).parent();
            $.ajax({
            url:"editCaskContent",
            type:"post",
            data:params,
            dataType:"json",
            success:function(e){
            obj.empty();
            obj.html("<font color=\"#00AA00\">追問:</font>");
            obj.append(e.caskContent);
            form.toggle();
            alert("修改成功!");
            },
            error:function(e){
            alert(e);
            }
            });
            });
            });
            其中,大家可以看到,在發(fā)出ajax請求之前,我提前定義了兩個(gè)變量,obj和form,分別用來存儲(chǔ)兩個(gè)jquery對象。如果在ajax的回調(diào)函數(shù)內(nèi)使用$(this)的話,實(shí)踐證明,是取不到任何對象的。具體原因,希望大神留言指教。。