You are asking a very simple question here. You must complete some Ajax tutorials first. Just to help you a bit (if you know the GET and POST methods for sending data), the "data" in the data: the "check" is different from the "data" in the function (data), are different. For clarity, you should call them different:
$.ajax({
type: "POST",
url: 'test.php',
data: "check",
success: function(response){
alert(response);
}
});
, , test.php POST, - , test.php . , , POST test.php, , ( , "type" :
$.ajax({
type: "POST",
url: 'test.php',
data: {"type":"check"},
success: function(response){
alert(response);
}
});
, , -.
, test.php :
if(isset($_POST['type'])){
echo "The type you posted is ".$_POST['type'];
}
: ", , - ". , "type" AJAX.