在php和jquery中添加行时出错?
在addrow.php文件中在php和jquery中添加行时出错?,php,jquery,Php,Jquery,在addrow.php文件中 jQuery('.checkModelButton').click(function(){ var url = jQuery(this).attr('href'); jQuery.ajax({ type:'get', cache: false, url: url, success: function(html){ jQuery('#model_row').html(html);
jQuery('.checkModelButton').click(function(){
var url = jQuery(this).attr('href');
jQuery.ajax({
type:'get',
cache: false,
url: url,
success: function(html){
jQuery('#model_row').html(html);
}
});
});
诺基亚N71
当我点击标签时,结果是:
<tr>Nokia N71</tr>
<table>
<thead>
<th>Name</th>
</thead>
<tboby id="model_row">
<tr>Nokia N71</tr>
</tbody>
</table>
名称
诺基亚N71
如何将其固定到结果是:
<tr>Nokia N71</tr>
<table>
<thead>
<th>Name</th>
</thead>
<tboby id="model_row">
<tr>Nokia N71</tr>
</tbody>
</table>
名称
诺基亚N70
诺基亚N71
使用.html()
将覆盖内容
您需要附加它
<table>
<thead>
<th>Name</th>
</thead>
<tboby id="model_row">
<tr>Nokia N70</tr>
<tr>Nokia N71</tr>
</tbody>
</table>
使用.append()
或.appendTo()
代替.html()
像
或
@安基特加塔姆:我没有看到他的html结构。我假设这是一行,这就是为什么我使用
insertAfter()
success: function(html){
jQuery('#model_row').append(html);
}
success: function(html){
jQuery(html).appendTo('#model_row');
}