2011-02-11 45 views
0

我有這個網站:ajax請求後替換別的東西?

<a href="#" class="cancel" id="cancel_3'">cancel</a> 

當用戶點擊取消,我想刪除的超級鏈接,我想即

$.ajax({ 
     context:this, 
     type: "POST", 
     url: "actions/cancel.php", 
     data: "id=" + the_id, 
     cache: false, 
     success: function() { 

      $(this).remove; 
     // add image 

謝謝:))

回答

2
用圖像替換此

請嘗試:

success: function() { 
    $("a#cancel_3").replaceWith("<img...>"); 
} 

您必須填寫HTML代碼ceWith功能與任何你想替換鏈接。只是我使用的佔位符。

0

如何:

$(this).css('display', 'none').after('<img>');