KillerDesigner
10/7/2013 - 11:21 PM

promise.html

<script>
  function doSomething(){

		var todo = $.Deferred();

		$.when("")
		.then(function(){
			setTimeout(function(){
				alert("Our First Thing is Done!!")
			}, 500)

		})
		.then(function(){

			setTimeout(function(){
				todo.resolve("Our whole promise is done!");
			}, 5000)
		})

		return todo.promise();

	}


	var aboutTo = doSomething().done(function(msg){ alert(msg)});




</script>