You can do this using jQuery: http://jquery.com/
Its a javascript framework and one of the methods you can use to do this kind of thing is:
$('#formID').submit(function(){
var ajaxURL = '/ajax/saveAccountSettings.php';
$.ajax({
type: 'POST',
url: ajaxURL,
data: {
username: $('#accountForm #username').val()
},
success: function(data){
//Do something
}
});
return false;
});
Probably worth reading up how to use jquery first though…
2
solved How to submit form without reloading? [duplicate]