Jquery 从ajax向表中追加数据不起作用
我有下面这样的桌子Jquery 从ajax向表中追加数据不起作用,jquery,asp.net,ajax,Jquery,Asp.net,Ajax,我有下面这样的桌子 <table class="table" id="tbl"> <thead> <tr> <th">ID</th> /* some headings */ </tr> </thead> <tbody class="tbodyAppend"> /* need to a
<table class="table" id="tbl">
<thead>
<tr>
<th">ID</th>
/* some headings */
</tr>
</thead>
<tbody class="tbodyAppend">
/* need to append data here */
</tbody>
</table>
这很好用
然后,出于某些需要,我在table标记中添加了runat=“server”
。我需要这个属性来获取服务器端的表,但是在我添加这个属性之后,这个附加就不起作用了。我在ajax中成功地获得了数据,但append不起作用
这里怎么了?请提供帮助。runat=“server”将表控件的id更改为“contentplaceholder name\u tbl”。
若您在searchAppend函数中访问id为“tbl”的表,它将找不到它 那么如何附加ajax结果呢?
$.ajax({
type: "POST",
url: "AdminView.aspx/searchNECB",
contentType: "application/json; charset=utf-8",
data: '',
dataType: "json",
success: function (data) {
console.log(data) // data coming here in both times
searchAppend(data.d);
},
error: function (msg) {
alert("error");
}
});