php is ajax request code example
Example 1: check if ajax request php
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
die($content);
}
Example 2: ajax php
$.ajax({
type: "POST",
url: "event.php",
data:"action=chnageChart&value1="+id,
cache: false,
success: function(html){
window.location.reload();
}
});
Example 3: ajax call php
$.ajax({ url: '/my/site',
data: {action: 'test'},
type: 'post',
success: function(output) {
alert(output);
}
});