Created
September 11, 2013 01:05
-
-
Save tddewey/6518077 to your computer and use it in GitHub Desktop.
In javascript, do something if the featured image (post thumbnail) is updated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Do something if the featured image is updated by inspecting ajaxComplete callback | |
jQuery(document).ajaxComplete(function(event, xhr, settings){ | |
// Parse the request | |
var vars = {}; | |
var requestVars = settings.data.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) { | |
vars[key] = value; | |
}); | |
// Take action if the action parameter is for the thumbnail | |
if ( vars.action === 'set-post-thumbnail') { | |
// Do something. | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment