I'm trying to submit a form without refreshing the page and so I used ajax. It gets the job done but my problem is that it refreshes the page. I want to prevent it from refreshing the page. Any help?
Code below:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
$(function() {
$("#deleteimages").click(function(e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: 'includes/do.php',
data: $(this).serialize(),
success: function(alert) {
alert(alert);
}
});
});
});
</script>
My submit button:
<input type="submit" name="deleteimages" id="deleteimages" value="DELETE">
Any help please? Thank you!