Send asapMail without reloading page using ajax
- by Darren Cook
Hi, I have a form that posts data to an aspMail file for delivery (works fine in current format), but would like to have the form data sent without having to re-direct to another page. Looks like Ajax is the way to proceed but I'm having a problem getting the setup to work.
Here's how I've changed the html:
Added:
$('#myForm').submit(function() {
$.ajax({
data: $(this).serialize(),
type: $(this).attr('post'),
url: $(this).attr('aspSend.asp'),
success: function(response) {
$('#created').html(response)
}
});
});
Changed the form tag from:
<form name="myForm" action"aspSend.asp">
to:
<form name="myForm">
but now the emails don't arrive!! Any suggestions?