From 8ea966c724d638e365b2399b2cddf365b9d7d9c5 Mon Sep 17 00:00:00 2001
From: colemanw <coleman@civicrm.org>
Date: Mon, 20 Jan 2020 13:21:22 -0500
Subject: [PATCH] Ajax api3 - Recommend .then instead of .done

Done has been deprecated for some time. Then is functionally equivalent and is forward-compatible with api4.
---
 docs/api/v3/usage.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/api/v3/usage.md b/docs/api/v3/usage.md
index d58967bf..d1721cac 100644
--- a/docs/api/v3/usage.md
+++ b/docs/api/v3/usage.md
@@ -161,11 +161,11 @@ For more details, see [REST interface](/api/interfaces.md#rest). 
 CRM.api3('entity', 'action', [params], [statusMessage]);
 ```
 
-If you pass `true` in as the `StatusMessage` param, it will display the default status message. This is useful when doing things such as adding tags to contacts or similar. If you wish to do further work based on the result of the API call (e.g use the results from a GET call) you will need to use the [done method](http://api.jquery.com/deferred.done/) to listen for the event. For example:
+If you pass `true` in as the `StatusMessage` param, it will display the default status message. This is useful when doing things such as adding tags to contacts or similar. If you wish to do further work based on the result of the API call (e.g use the results from a GET call) you will need to use the [then method](http://api.jquery.com/deferred.then/) to listen for the event. For example:
 
 ```javascript
 CRM.api3('entity_tag', 'create', {contact_id:123, tag_id:42})
-  .done(function(result) {
+  .then(function(result) {
     console.log(result);
   });
 ```
@@ -177,7 +177,7 @@ var params = [
   ['email', 'get', {contact_id: 123}],
   ['phone', 'get', {phone: '555-5555'}]
 ];
-CRM.api3(params).done(function(result) {
+CRM.api3(params).then(function(result) {
   console.log('email result is:', result[0]);
   console.log('phone result is:', result[1]);
 });
@@ -191,7 +191,7 @@ var params = {
   two: ['phone', 'getoptions', {field: 'phone_type_id', sequential: 1}],
   three: ['phone', 'get']
 };
-CRM.api3(params).done(function(result) {
+CRM.api3(params).then(function(result) {
   console.log('email result is:', result.one);
   console.log('phone options are:', result.two);
   console.log('phone get result is:', result.three);
-- 
GitLab