파일을 업로드하는 버튼이 있습니다. 3 초마다 ajax 요청을 보내서 업로드 된 사진을 표시하고 있습니다. 문제는 그 때마다 이미지를 표시하고 싶습니다. 사용자가 업로드 버튼을 클릭하고 성공하면 숨기지 만 이미지가 표시되지 않습니다. 위에서 말했듯이 업로드 된 사진을 가져 오기 위해 또 다른 아약스 호출이 있으며 사진이 숨겨져 있다고 생각합니다. 사용자가 단추를 클릭하면 로딩 이미지가 표시되고 두 번째 아약스 호출이 업로드 된 이미지를 사용자에게 다시 표시하면 이미지를 숨길 수 있기를 바랍니다. 누군가 나에게 힌트를 줄 수 있습니까?이미지가 jquery로 표시되지 않습니다.
$("#loading_image").html('<div class="loadm"><img src="../image/ajax-loader.gif"/>//I have tried putting the loading image on the also.
$(document).ready(function()
{
profileRefresh();
var uploaded_files_location = "../img/";
new AjaxUpload($('#upload_button '),
{
hoverClass: 'btn - primary',
action: 'picture.php ? target = profile ',
name: 'file_to_upload ',
onSubmit: function(file, file_extensions){
$('#errormsg ').html('');
if (!(file_extensions && /^(jpg|png|jpeg|gif|JPG)$/.test(file_extensions)))
{
$('#error ').html(' < div class = "error" align = "left" > Sorry, you can only upload the following file formats : JPG, JPEG, PNG and GIF... < /div>');
return false;
}
else
{
$("#loading_image").html('<div class="loadm"><img src="../image/ajax - loader.gif "/></div>');//this is the loading image that is not showing.
return true;
}
},
onComplete: function(file, response){}
});
});
var profileRefresh = function() {
$.ajax({
type: "GET ",
url: "picture ? target = refresh ",
success: function(response){
$("#pro").html(response);
setTimeout(profileRefresh, 3000);
$("#loading_image ").fadeOut('fast');// hide the loading image
}
});
};
설정하거나 이미지를 얻을시겠습니까? –
@Soombinakundi 업로드 된 이미지가 두 번째 ajax 호출을 통해 사용자에게 다시 표시 될 때까지 간단히로드 이미지를 계속 표시합니다. – user3412305