Open In App

jQuery deferred.progress() Method

This deferred.progress() method in jQuery is used to add handlers which are to be called when the Deferred object generates progress notifications.

Syntax:



deferred.progress(progressCallbacks[, progressCallbacks])

Parameters:

Return Value: This method returns the deferred object.



Example 1: In this example, The progress() method is called with the reject() method.




<!DOCTYPE HTML>
<html>
  
<head>
    <script src=
    </script>
</head>
  
<body style="text-align:center;">
  
    <h1 style="color:green;">
        GeeksForGeeks
    </h1>
  
    <p>
        JQuery | deferred.progress() method
    </p>
  
    <button onclick="Geeks();">
        click here
    </button>
      
    <p id="GFG"></p>
  
    <script>
        function Func(val, div) {
            $(div).append(val);
        }
        function Geeks() {
            var def = $.Deferred();
            def.fail(Func);
            def.progress(Func);
            def.reject('"Func" is added as '
                + 'progressCallbacks using '
                + 'progress() method when '
                + 'Deferred object is rejected',
                  '#GFG')
        
    </script>
</body>
  
</html>

Output:

Example 2: In this example, the progress() method is called with the resolve() method.




<!DOCTYPE HTML>
<html>
  
<head>
    <script src=
    </script>
</head>
  
<body style="text-align:center;">
    <h1 style="color:green;">
        GeeksForGeeks
    </h1>
  
    <p>
        JQuery | deferred.progress() method
    </p>
  
    <button onclick="Geeks();">
        click here
    </button>
      
    <p id="GFG"></p>
  
    <script>
        function Func(val, div) {
            $(div).append(val);
        }
        function Geeks() {
            var def = $.Deferred();
            def.done(Func);
            def.progress(Func);
            def.resolve('"Func" is added as '
                + 'progressCallbacks using '
                + 'progress() method when '
                + 'Deferred object is resolved',
                  '#GFG')
        
    </script>
</body>
  
</html>

Output:


Article Tags :