diff --git a/src/js/_enqueues/lib/ajax-response.js b/src/js/_enqueues/lib/ajax-response.js index b764823742..f1b0dcd361 100644 --- a/src/js/_enqueues/lib/ajax-response.js +++ b/src/js/_enqueues/lib/ajax-response.js @@ -18,7 +18,7 @@ window.wpAjax = jQuery.extend( { return r; }, parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission. - var parsed = {}, re = jQuery('#' + r).empty(), err = '', successmsg = ''; + var parsed = {}, re = jQuery('#' + r).empty(), err = '', noticeMessage = ''; if ( x && typeof x === 'object' && x.getElementsByTagName('wp_ajax') ) { parsed.responses = []; @@ -27,11 +27,14 @@ window.wpAjax = jQuery.extend( { var th = jQuery(this), child = jQuery(this.firstChild), response; response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') }; response.data = jQuery( 'response_data', child ).text(); - if ( jQuery( 'body' ).hasClass( 'edit-tags-php' ) ) { - successmsg += response.data; - } response.supplemental = {}; if ( !jQuery( 'supplemental', child ).children().each( function() { + + if ( this.nodeName === 'notice' ) { + noticeMessage += jQuery(this).text(); + return; + } + response.supplemental[this.nodeName] = jQuery(this).text(); } ).length ) { response.supplemental = false; } response.errors = []; @@ -52,10 +55,10 @@ window.wpAjax = jQuery.extend( { if ( err.length ) { re.html( '
' + successmsg + '
' + noticeMessage + '