$.ajax({
url: "_includes/contactform.php",
type: "POST",
data:'name=' + nameValue + "&email=" + emailValue + "&text=" + textValue + "&checkbox=" + checkValue + "&submit=true",
dataType:"json",
success: function(data,result,res) {
alert(res);
console.log(data);
if(data.checkbox == "true"){
$("#success h1").html("The form was sent successfully. Thank you for signing up for our newsletter.")
}
});
My script gets stuck when running.
here is the server return:
$json_array = array("checkbox" => $checkbox);
echo json_encode($json_array);