1
<a class="checkModelButton" href="addrow.php">ADD ROW</a>
<table>
<thead>
<th>Name</th>
</thead>
<tboby id="model_row">
<tr>Nokia N70</tr>
</tbody>
</table>
和jQuery:在php和jquery中添加行時出錯?
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);
}
});
});
文件addrow.php
<tr>Nokia N71</tr>
當我點擊一個標籤結果:
<table>
<thead>
<th>Name</th>
</thead>
<tboby id="model_row">
<tr>Nokia N71</tr>
</tbody>
</table>
如何解決它導致是:
<table>
<thead>
<th>Name</th>
</thead>
<tboby id="model_row">
<tr>Nokia N70</tr>
<tr>Nokia N71</tr>
</tbody>
</table>
@AnkitGautam:我沒有看到他的HTML結構。我認爲這是一個行,這就是爲什麼我使用'insertAfter()' – 2012-07-29 06:42:23