我的主機有一個formmail.cgi腳本,用於將html表單數據發送到電子郵件(http://formmail.dreamhost.com/),但我不知道如何傳遞它理解的值。將值傳遞給formmail.cgi而不刷新(HTML表單PHP處理)
HTML::
<form id="contact_form" action="http://formmail.dreamhost.com/cgi-bin/formmail.cgi" method="POST">
<input type=hidden name="recipient" value="info#raphaelguilleminot.com">
<input type="hidden" name="subject" value="Message from Raphael's portfolio site" />
<input type=text id="email" class="email default-value" name="email" value="Your email">
<label class="error" for="email" id="email_error">your email is required</label>
<textarea id="message" class="contact_message default-value" name="message" value="your message">Tell me whats on your mind!</textarea><br/>
<input class="submit button" type="submit" value="Send" />
</form>
Jquery的:
$(".button").click(function() {
var dataString = 'recipient=info#raphaelguilleminot.com' + 'name='+ name + '&email=' + email + '&message=' + message;
$.ajax({
type: "POST",
url: "http://formmail.dreamhost.com/cgi-bin/formmail.cgi",
data: dataString,
success: function() {
$('#contact_form').hide().fadeIn(1500)
}
});
return false;
});
});
任何想法使用這種方法來傳遞表單值
伊夫試過?
感謝您的反饋,我很喜歡SO社區! – Raphael 2010-08-03 10:05:53