Changeset 46960
- Timestamp:
- 12/15/2019 08:43:42 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/wp/util.js
r43347 r46960 95 95 deferred = $.Deferred( function( deferred ) { 96 96 // Transfer success/error callbacks. 97 if ( options.success ) 97 if ( options.success ) { 98 98 deferred.done( options.success ); 99 if ( options.error ) 99 } 100 101 if ( options.error ) { 100 102 deferred.fail( options.error ); 103 } 101 104 102 105 delete options.success; … … 106 109 deferred.jqXHR = $.ajax( options ).done( function( response ) { 107 110 // Treat a response of 1 as successful for backward compatibility with existing handlers. 108 if ( response === '1' || response === 1 ) 111 if ( response === '1' || response === 1 ) { 109 112 response = { success: true }; 113 } 110 114 111 if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) 115 if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) { 112 116 deferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [response.data] ); 113 else117 } else { 114 118 deferred.rejectWith( this, [response] ); 119 } 115 120 }).fail( function() { 116 121 deferred.rejectWith( this, arguments );
Note: See TracChangeset
for help on using the changeset viewer.