why does submit button refresh page and not just ajax page code example
Example: submit form without page refresh using ajax jquery and php
$(document).ready(function(){
$('button').click(function(event){
event.preventDefault();
var name = $('#name').val();
var mobile = $('#mobile').val();
var address = $('#address').val();
var city = $('#city').val();
$.ajax({
type: "POST",
url: "upload.php",
data: { name:name, mobile:mobile, address:address, city:city },
dataType: "json",
success: function(result){
}
});
});
});