//db connect
$server = 'localhost';
$username = 'root';
$password = '';
$database = 'resort';
$connect = mysqli_connect($server, $username, $password ) or die(mysqli_error.'error connecting to db');
//select database
mysqli_select_db ($database, $connect) or die(mysqli_error.'error selecting db');/*Jquery Function*/<script>
$(function(){
//CONTACT FORM AJAX SUBMIT
$('#contactForm').submit(function(){
$.ajax({
url:'mailer.php',
type : 'POST',
dataType: 'json',
data: $(this).serialize(),
success: function(data){
if(data.error){
$('#error').css('display','block');
}else {
$('#note').show();
$('#error').hide();
$(".contact-form").hide();
}
}
});
return false;
});
});
</script>
issue is that when i am trying to click on submit the webpage refreshes and the contents are shown in the url. Errors does not occur so no way to find out what the problem is. I am trying to build a contact form that can send mail. So you will also get some code related to it.The main issue is that why the page refreshes every time and why there is not any error if, database is connected or not,query written for insertion of data is correct or not, variables are correctly declared or not.