jQuery.when() 方法

jQuery 教程 · 2019-03-28 21:17:24

实例

一个参数传递给 $.when() 被受理,执行回调函数

$(function () { $.when( { testing: 123 } ).done( function(x) { alert(x.testing); } /* alerts "123" */ ); })

定义和用法

$.when() 函数提供一种方法来执行一个或多个对象的回调函数。

提示:如果向 jQuery.when 传入一个延迟对象,那么会返回它的 Promise 对象(延迟方法的一个子集)。 可以继续绑定 Promise 对象的其它方法,例如, defered.then 。当延迟对象已经被受理(resolved) 或被拒绝(rejected)(通常是由创建延迟对象的最初代码执行的),那么就会调用相应的回调函数。

语法

$.when( deferreds )

参数 描述
deferreds Deferred类型 一个或多个延迟对象,或者普通的JavaScript对象

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Two Scoops of Django

Two Scoops of Django

Daniel Greenfeld、Audrey M. Roy / CreateSpace Independent Publishing Platform / 2013-4-16 / USD 29.95

Two Scoops of Django: Best Practices For Django 1.5 is chock-full of material that will help you with your Django projects. We'll introduce you to various tips, tricks, patterns, code snippets, and......一起来看看 《Two Scoops of Django》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具