Send asapMail without reloading page using ajax

Posted by Darren Cook on Stack Overflow See other posts from Stack Overflow or by Darren Cook
Published on 2009-11-26T14:28:32Z Indexed on 2010/03/18 12:01 UTC
Read the original article Hit count: 239

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about jQuery