I want to sent an request with POST method to a file cookie.php to plot my form in the index. My php file looks like this `
$cookie_name="User";
$cookie_value="John";
$days=365;
setcookie($cookie_name,$cookie_value,time()+($days*30),"/");
?>
and my Ajax coding looks like this:
$(document).ready(function(){
$("#cookie-form").click(function(){
$.ajax({
method:"POST";
url:"cookie.php";
.success(function(data){
$("#cookie_name").append($_COOKIE[$cookie_name])
}
}
}
$("#check-cookie-form").click(function(){
$.ajax({
method:"POST";
url:"check_cookie.php";
}
}
});