为什么ajax" $(" .select")。append(result)"不行? [英] why ajax "$(".select").append(result) " not work?

查看:74
本文介绍了为什么ajax" $(" .select")。append(result)"不行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨所有

这是我的ajaxcode:

hi all
it's my ajaxcode :

$.ajax(
               {
                   type: "POST",
                   url: "didan.asmx/sending",
                   data: { st: $(".myInput").attr('id') },
                   dataType: "text",
                   success: accessfn(result),
               }
                              )
        }
        

        function accessfn(result) {
            
            $("#divmess").append(result);
        }



结果内容为:


"result" content is:

<input id="el12" value="tax" type="button" />



但是:


but by:

            $("#divmess").append(result);
//or
            $("#divmess").html(result);



它不会生成可视按钮而只是追加< input class =myInputid =acavalue =taxtype =button/> div的字符串结尾。

感谢所有


it doesn't make visual button and just append exactly " <input class="myInput" id="aca" value="tax" type="button" />" string end of div.
thanks all

推荐答案

.ajax(
{
type:POST,
url:didan.asmx / sending,
data:{st:
.ajax( { type: "POST", url: "didan.asmx/sending", data: { st:


(。myInput)。attr('id')},
dataType:text,
成功:accessfn(结果),
}

}


函数accessfn(结果){
(".myInput").attr('id') }, dataType: "text", success: accessfn(result), } ) } function accessfn(result) {


(#divmess)。append(result);
}
("#divmess").append(result); }



结果内容为:


"result" content is:

<input id="el12" value="tax" type="button" />



但是:


but by:


这篇关于为什么ajax&quot; $(&quot; .select&quot;)。append(result)&quot;不行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆