用于显示和QUOT方法;装载"信息方法、信息、QUOT

2023-09-11 00:58:39 作者:正在加载……

我使用jQuery和的getJSON方法,我想知道是否有一种方法来显示一个消息,说加载它加载我的内容之前。我知道有jQuery的Ajax调用还有就是前提交的回调,你可以有一些东西,但的getJSON只有像三个选项。

I am using jquery and the getJSON method and I am wondering if there is a way to display a message saying loading before it loads my content. i know with the jquery ajax calls there is the before submit callbacks where you can have something but the getJSON only has like three options.

任何想法?

推荐答案

阿贾克斯之前和成功的事件,你可以触发自定义。

there is the custom .ajax "before" and "success" events which you can trigger.

不过通常情况下,你只需做一些像

Normally however, you would just do something like


  showLoadingAnimation(); 
  $.getJSON(  ..... function(){
      dontShowLoadingAnimation(); 
  }); 

或类似的东西。

or something similar.

您的问题是,但是有些vauge,它很难确定什么是你想做的事,你会不会已经能够用JavaScript做简单的。

Your question is however somewhat vauge, and its hard to ascertain what it is you want to do that you wouldn't already be able to do simply with javascript.

 
精彩推荐