【发布时间】:2013-05-15 01:01:13
【问题描述】:
我怎样才能制作一个简单的 html 表单(只有名称和电子邮件),当提交一点 Jquery 时,它会在页面上找到一个特定的链接,并将它与表单中的信息一起发送到一个 web 服务器,然后脚本从表格中向电子邮件地址发送电子邮件以及链接 链接总是以相同的东西开头,看起来像:
http://www.exemple.com/abcd/1u3odjeo
http://www.exemple.com/abcd/340fkdl4
这是我现在得到的表格:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$('#submit').click(function(){
$.post("send.php", $("#mycontactform").serialize(), function(response) {
$('#success').html(response);
//$('#success').hide('slow');
});
return false;
});
});
</script>
</head>
<body>
<form action="" method="post" id="mycontactform" >
<label for="name">Name:</label><br />
<input type="text" name="name" id="name" /><br />
<label for="email">Email:</label><br />
<input type="text" name="email" id="email" /><br />
<input type="button" value="send" id="submit" /><div id="success" style="color:red;"></div>
</form>
</body>
</html>
我错过了链接抓取以及如何将其添加到发送电子邮件的脚本中。
感谢您的帮助
【问题讨论】:
-
这些链接将在您的页面上的什么位置?
-
这些链接是静态的吗?似乎在隐藏的表单字段中包含链接的 URL 会更容易。