显示加载信息,而使用jQuery阿贾克斯ASP加载内容 [英] show loading message while loading contents in asp using jquery ajax

查看:154
本文介绍了显示加载信息,而使用jQuery阿贾克斯ASP加载内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ASP网站我试图在页面加载获取从Active Directory用户详细信息。我喜欢展示loading.gif的形象,直到我得到的细节。可能有些帮助我,因为我是新来的jQuery

In my asp site i'm trying to fetch user details from Active directory on page load. I like to show "loading.gif" image untill I get details. Could some help me as i'm new to jquery

推荐答案

AJAX的简单形式是应为你的需求是不够的获得()方法。

Simple form of AJAX is the .get() method which should be enough for your needs.

首先,加在你的HTML的占位符,其中加载图像会出现那么当您已加载的内容,这些内容将被替换放置的图像。

First of all, add a placeholder in your HTML where the loading image will appear then when you have the contents loaded, those contents will be placed instead of the image.

例如:

<div id="ContentsPlaceholder"></div>

jQuery的code现在是:

The jQuery code would now be:

$(function() {
    $("#ContentsPlaceholder").html("<img src='Loading.gif' />");
    $.get("GetData.asp", function(contents) {
        $("#ContentsPlaceholder").html(contents);
    });
});

这将会把Loading.gif图像占位符,然后加载从名为GetData.asp页面数据,并在数据可用它会把它,而不是图像。

This will put "Loading.gif" image in the placeholder then load data from page called "GetData.asp", and when the data is available it will put it instead of the image.

这篇关于显示加载信息,而使用jQuery阿贾克斯ASP加载内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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