Changeset 53123
- Timestamp:
- 04/11/2022 04:35:37 AM (2 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/lib/ajax-response.js
r52672 r53123 19 19 }, 20 20 parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission. 21 var parsed = {}, re = jQuery('#' + r).empty(), err = '', successmsg= '';21 var parsed = {}, re = jQuery('#' + r).empty(), err = '', noticeMessage = ''; 22 22 23 23 if ( x && typeof x === 'object' && x.getElementsByTagName('wp_ajax') ) { … … 28 28 response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') }; 29 29 response.data = jQuery( 'response_data', child ).text(); 30 if ( jQuery( 'body' ).hasClass( 'edit-tags-php' ) ) {31 successmsg += response.data;32 }33 30 response.supplemental = {}; 34 31 if ( !jQuery( 'supplemental', child ).children().each( function() { 32 33 if ( this.nodeName === 'notice' ) { 34 noticeMessage += jQuery(this).text(); 35 return; 36 } 37 35 38 response.supplemental[this.nodeName] = jQuery(this).text(); 36 39 } ).length ) { response.supplemental = false; } … … 53 56 re.html( '<div class="error">' + err + '</div>' ); 54 57 wp.a11y.speak( err ); 55 } else if ( successmsg.length ) {56 re.html( '<div class="updated notice is-dismissible"><p>' + successmsg+ '</p></div>');58 } else if ( noticeMessage.length ) { 59 re.html( '<div class="updated notice is-dismissible"><p>' + noticeMessage + '</p></div>'); 57 60 jQuery(document).trigger( 'wp-updates-notice-added' ); 58 wp.a11y.speak( successmsg);61 wp.a11y.speak( noticeMessage ); 59 62 } 60 63 return parsed; -
trunk/src/wp-admin/includes/ajax-actions.php
r53089 r53123 1122 1122 'what' => 'taxonomy', 1123 1123 'data' => $message, 1124 'supplemental' => compact( 'parents', 'noparents' ), 1124 'supplemental' => array( 1125 'parents' => $parents, 1126 'noparents' => $noparents, 1127 'notice' => $message, 1128 ), 1125 1129 ) 1126 1130 );
Note: See TracChangeset
for help on using the changeset viewer.