我希望發生的是,class="profile-pic"
將刷新/前或對話框關閉,因爲圖像源的變化重裝。如何使用jquery重新加載特定的html標籤?
這是我的代碼:
$('.change-profile-pic').click(updateProfilePicture);
function updateProfilePicture(){
$('#dialog').dialog({
resizable:false,
modal:true,
width:225,
buttons: {
'Upload':function(){
$('#upload-image').ajaxForm({
target: '.new-profile-pic'
}).submit();
},
'Done':function(){
$.ajax({
url: 'update-profile-pic.php',
type: 'post',
data: { file_path: $('.new-profile-pic img').attr('src') },
success: function(data) {
if(data == 'Success'){
$('#dialog').dialog('close');
}
}
});
}
}
});
HTML重新加載:
<p class="profile-pic ">
<a href="#"><img class="change-profile-pic ui-corner-all" src="<?php echo $user['user_profile_path']; ?>" alt=""></a>
</p>
HTML表單:
<div title="Change profile picture" id="dialog" class="dialog-change-profile-pic">
<div class="new-profile-pic">
</div>
<form id="upload-image" enctype="multipart/form-data" action="upload-image.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<input class="profile-pic-name" name="uploadedfile" type="file">
</form>
</div>
應該怎樣重裝後包含'#loadthis'? –
可以刷新的div而不是重裝 – Hkachhia
的圖像,我所要做的事就 –