ajax php post request code example
Example 1: ajax jquery post php
$.ajax({
url : "file.php",
method : "POST",
data: {
action : action ,
key_1 : value_key_1,
key_2 : value_key_2
}
})
.fail(function() { return false; })
.done(function(data) {
console.log(data);
});
Example 2: ajax post example php
var values = $(this).serialize();
$.ajax({
url: "test.php",
type: "post",
data: values ,
success: function (response) {
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
}
});