Stadard ajax call for Wordpress with JQuery
jQuery.ajax(ajaxurl,{ //ajax url is not available in the front end. Needs to wp_localize_script
data: {
action: "", //the action specified in ajax wordpress hooks
//other_param: new_value,
//another_param: another_value
},
dataType: "json", //Default is an "intelligent guess"; does not work very often
method: "POST" //Default is GET
}).done(function(data, textStatus, jqXHR){
console.log(data);
}).fail(function(jqXHR, textStatus, errorThrown){
console.log(errorThrown);
}).always(function(result, textStatus, type){
console.log(type);
});