显示加载GIF图像,同时加载与AJAX [英] Display loading GIF image while loading with AJAX

查看:210
本文介绍了显示加载GIF图像,同时加载与AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

   $.ajax({
        url: "/image/productImages.jpg",
        timeout:5000,

        beforeSend: function(){
    // Handle the beforeSend event
        $('##loading').show();
        },

        complete: function(){
        // Handle the complete event
        $('##loading').hide();
        },

        success: function (data) {
            alert("image was added successfully");
        },

        error: function () {
            alert("There was an error. Image could not be added, please try again");
        }
    });

我想显示显示加载GIF图像时加载,然后一旦图像加载将其删除。在这里,我有这个code要做到这一点,但是,这是直行错误。没有任何人有任何想法,为什么或如何解决这一问题。在此先感谢!

I'm want to show display loading gif while image is loading and then remove it once image is loaded. Here I have this code to do that but, this is going straight to error. does anyone have any idea why or how to fix this. Thanks in advance!

推荐答案

您的ID选择有两个哈希值,

Your id selector has two hashes,

试试这个来代替:

 $('#loading').show();

这篇关于显示加载GIF图像,同时加载与AJAX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆