-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
41 lines (33 loc) · 1.14 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Mailto Ajax Sample</title>
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="js/jquery-1.12.0.min.js"></script>
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>Mailto Ajax Sample</h1>
</div>
<div id="content">
<a id="mailto" href="#">Click to email me.</a>
<script type="text/javascript">
$("#mailto").click(function(event){
event.preventDefault(); // Prevent the execution of the default onClick event of the link.
// Fetch the mail information from the server in json format using ajax...
$.ajax({
url: 'ajax/mailto.json',
dataType: 'json',
success: function (response) {
// ... and add the link to window.location to execute the link.
$(location).attr('href', "mailto:" + response.user + "%40" + response.domain);
}
});
});
</script>
</div>
</div>
</body>
</html>