I have this AJAX call
$(function() {
$("button#submit").click(function(){
$.ajax({
type: "POST",
url: "process.php",
data: $("form.contact").serialize(),
success: function(msg){
$(".alert-success").toggle();
$("#form-content").modal("hide");
},
error: function(){
$(".alert-error").toggle();
}
});
});
});
The problem is that in process.php i only have
echo "OK";
In console i see resposne but not on page, what can be problem?
You get msg
as result of ajax call but you don't use it anywhere. You can use it inside success for example:
$(function() {
$("button#submit").click(function(){
$.ajax({
type: "POST",
url: "process.php",
data: $("form.contact").serialize(),
success: function(msg){
$(".alert-success").toggle();
$("#form-content").modal("hide");
//console.log(msg); to get the result in console for example
},
error: function(){
$(".alert-error").toggle();
}
});
});
});