加载图像时不显示jquery

加载图像时不显示jquery,jquery,ajax,Jquery,Ajax,我有一个文件上传按钮,它通过ajax上传文件,我每3秒钟发送一次ajax请求来显示上传的图片,问题是,每当用户单击上传按钮时,我都想显示一个正在加载的图像,并在成功时隐藏它,但图像没有显示。如上所述,我有另一个ajax调用来获取上传的图片,我认为它隐藏了图片。所以我想要的是,当用户单击按钮显示加载的图像时,然后当第二次ajax调用将上传的图像显示回用户时,隐藏图像。有人能给我个提示吗 $("#loading_image").html('<div class="loadm"><i

我有一个文件上传按钮,它通过ajax上传文件,我每3秒钟发送一次ajax请求来显示上传的图片,问题是,每当用户单击上传按钮时,我都想显示一个正在加载的图像,并在成功时隐藏它,但图像没有显示。如上所述,我有另一个ajax调用来获取上传的图片,我认为它隐藏了图片。所以我想要的是,当用户单击按钮显示加载的图像时,然后当第二次ajax调用将上传的图像显示回用户时,隐藏图像。有人能给我个提示吗

$("#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
        }
    });
};
$(“#加载_图像”).html('//我也尝试过将加载图像放在屏幕上。
$(文档).ready(函数()
{
profileRefresh();
var上传的文件位置=“../img/”;
新的AjaxUpload($(“#上传按钮”),
{   
hoverClass:'btn-主',
操作:“picture.php?target=profile”,
名称:“文件到上传”,
onSubmit:函数(文件、文件扩展名){
$('#errormsg').html('');
if(!(文件扩展名&/^(jpg | png | jpeg | gif | jpg)$/.test(文件扩展名)))
{
$('#error').html('
对不起,您只能上载以下文件格式:JPG、JPEG、PNG和GIF…
); 返回false; } 其他的 { $(“#加载_图像”).html(“”)//这是未显示的加载图像。 返回true; } }, onComplete:函数(文件、响应){} }); }); var profileRefresh=函数(){ $.ajax({ 键入:“获取”, url:“图片?目标=刷新”, 成功:功能(响应){ $(“#pro”).html(回应); setTimeout(profileRefresh,3000); $(“#加载图像”).fadeOut('fast');//隐藏加载图像 } }); };
做一件事。将加载图像保存在img标签中,如下所示

<img id="load" src="../image/ajax-loader.gif"/>

您想设置或获取图像吗?@Soombinakundi只需在上传的图像通过第二次ajax调用显示给用户之前一直显示加载的图像。
$("#loading_image").html($("#load").html());