Skip to content

Instantly share code, notes, and snippets.

@kprimdal
Created October 22, 2012 12:57
Show Gist options
  • Save kprimdal/3931379 to your computer and use it in GitHub Desktop.
Save kprimdal/3931379 to your computer and use it in GitHub Desktop.
WP: Ajax jQuery
$.ajax({
type: 'POST',
url: MyAjax.ajaxurl,
data: {
action: 'action_which_handle_request',
pid: $this.attr('data-id')
},
success: function(data, textStatus, XMLHttpRequest){
$this.empty().append(data);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment