1. ('#register') => Form's id
2. $('#advert') => where response has to load
<script>
$('#register').submit(function() { // catch the form's submit event
$.ajax({ // create an AJAX call...
data : $(this).serialize(), // get the form data
type : $(this).attr('method'), // GET or POST
url : $(this).attr('action'), // the file to call
success : function(response) { // on success..
$('#advert').load('Views/userAdded.jsp'); }
});
return false; // cancel original event to prevent form submitting
});
</script>
No comments:
Post a Comment