php jquery.post code example
Example 1: ajax post example php
/* Get from elements values */
var values = $(this).serialize();
$.ajax({
url: "test.php",
type: "post",
data: values ,
success: function (response) {
// You will get response from your PHP page (what you echo or print)
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
}
});
Example 2: js ajax post strings
$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType
});