Home  >  jQuery

Example of deferred.then() in jQuery

April 30, 2013
deferred.then() adds a handler to itself and this handler will be called when the deferred object will be resolved or rejected or keep on progress. In all these scenario deferred.then() calls the added handler.
deferred.then()
 
Find the example.

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<p></p>
<script>
	var defer = $.Deferred();
	defer.then(function( value ) {
	    $( "p" ).html('You are at '+ value +' page');
	});
    defer.resolve( 'jQuery' );

</script>
</body>
</html>
 




Output

You are at jQuery page

FIND MORE TUTORILAS






©2019 concretepage.com | Privacy Policy | Contact Us