我的主机有一个 formmail.cgi 脚本来将 html 表单数据发送到电子邮件(http://formmail.dreamhost.com/),但我不明白如何传递它理解的值。
我试过使用这种方法来传递表单值:
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>
查询:
$(".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;
});
});
有任何想法吗?