Just for completeness, here is my javascript AJAX handler. The error printed in the console is the result of the error callback (console.log(errorThrown))
jQuery(document).ready(function() {
jQuery('#submit-img').click(function(e) {
e.preventDefault();
jQuery.ajax({
url: MyAjax.ajaxURL,
type: 'post',
data: {
action: 'ajax-submit-handler',
postID: MyAjax.postID,
nonceID: MyAjax.nonceID,
imgURL: jQuery('#img-url').val()
},
success: function(response) {
console.log(response.data);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
}
});
});
});
where MyAjax is defined with wp_localize_script.