我有這個加載內容的腳本,然後應該綁定刪除鏈接以刪除內容。綁定與jQuery,錯誤的順序?
但是我發現它沒有與刪除鏈接綁定,即使這樣我就把代碼放在了一個應該重新綁定的函數中。
$(document).ready(function() {
function loadImages() {
$.get('/management/image/get/site_id/1/area/News', function(data) {
$("#existing-images").html(data);
});
$(".deleteImage").click(function() {
id = $(this).attr('id'); id = id.split('_');
alert(id);
/*$.post(second_url+'id/'+id, '', function(theResponse) {
$("#image_"+id+"").remove();
});*/
});
}
$("#fileInput").uploadify({
'uploader' : '/library/jquery/uploadify/uploadify.swf',
'script' : '/gallery/image/area/site_id/<?php echo $site->id; ?>/area/<?php echo $this->area; ?>',
'cancelImg' : '/library/jquery/uploadify/cancel.png',
'folder' : '/images/Image/',
'multi' : true,
'onAllComplete' : function(e, queueId, file, response, data) {
$('#fileInput').uploadifyClearQueue();
loadImages();
},
});
loadImages();
});
檢查你的 '刪除圖像' ID的拼寫/大寫。 – 2011-02-14 11:35:01