title: jQuery Deferred and promise - Error: Object doesn't support property or method 'then'
body: <p>I'm probably missing something really basic here but I can't seem to find the error and it's getting frustrating. I'm just trying to pull the lists (and then items, but one thing at a time here) from my dev SharePoint site.</p>
  
  <p>I've got the first deferred method built and the console log shows that it completes, but then I get "Error: Object doesn't support property or method 'then'" as though jQuery is failing somehow.</p>
  
  <p>For reference I'm trying to follow the method described here: <a href="http://www.shillier.com/archive/2013/03/04/using-promises-with-the-javascript-client-object-model-in-sharepoint-2013.aspx" rel="nofollow">http://www.shillier.com/archive/2013/03/04/using-promises-with-the-javascript-client-object-model-in-sharepoint-2013.aspx</a> </p>
  
  <p>Here's the code:</p>
  
  <pre><code>&lt;script src="jquery-1.11.2.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  
      $(function () {
  
          GetSiteLists.bListsGotten().then(
              function (oWebLists) {
                  // Get Lists Succeeded
                  alert('Lists Retrieved');
              }
              , function (sender, args) {
                  // Get Lists Failed
                  alert('Lists Not Retrieved');
              }
          );
  
      });
  
      GetSiteLists = function () {
          var bListsGotten = function () {
  
              var deferred = $.Deferred();
  
              var oContext = new SP.ClientContext.get_current();
              console.log('oContext instantiated');
              var oWeb = oContext.get_web();
              console.log('oWeb instantiated');
              this.oWebLists = oWeb.get_lists();
              console.log('oWebLists command set');
              oContext.load(this.oWebLists);
              console.log('context load command set');
              oContext.executeQueryAsync(
                  Function.createDelegate(this,
                      function () { deferred.resolve(this.oWebLists); }),
                  Function.createDelegate(this,
                      function (sender, args) { deferred.reject(sender, args); }));
              console.log('list retrieval query executed async');
  
              console.log('returning promise');
              return deferred.promise;
          }
  
          return {
  
              bListsGotten: bListsGotten
          }
      }();
  
  &lt;/script&gt;
  </code></pre>