0
如何在jQuery ajax成功函數中刪除和添加類?jquery ajax成功刪除進程中的類添加頁面
的index.html
$.ajax({
url: "text.php",
dataType: "html",
type: 'POST',
data: "data=test",
success: function(data){
$("#result").html(data);
$('#show').find('.show').removeClass('show').addClass('hidden');
$('#show').find('.hidden').html('hidden');
}
});
<div id="result"></div>
text.php,東西就象這樣:
<a href="#" id="show"><p class="show">show</p></a>
,我需要在div#result
返回回HTML作爲
<a href="#" id="show"><p class="hidden">hidden</p></a>