Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update source for final tut

This is the final version with updated information for the screencast
  • Loading branch information...
commit a75cd89d8a224ad06579854a5fcb4de1e8b94f68 1 parent 3cb25dc
@pinehead authored
Showing with 32 additions and 36 deletions.
  1. +30 −34 index.php
  2. +2 −2 php.php
View
64 index.php
@@ -2,53 +2,49 @@
<head>
<title>
</title>
-<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" />
-<script type="text/javascript" src="ajax.js" />
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
-$(document).ready(function() {
-
- $('#submit').click(function() {
-
-
- var name = $('#name').val();
- var email = $('#email').val();
- var data = 'name=' + name + '&email=' + email;
-
-
- $.ajax({
- type: "POST",
- url: "php.php",
- data: data,
- success: function() {
- alert("notification sent");
- }
-
- });
+ $(document).ready(function() {
+
+
+ $('#submit').click(function() {
+
+
+
+ var name = $('#name').val();
+ var email = $('#email').val();
+
+ var varData = 'name=' + name + '&email=' + email;
+ console.log(varData);
+
+ $.ajax({
+ type: "POST",
+ url:'php.php',
+ data: varData,
+ success: function() {
+ alert("It was a success");
+ }
+
+ });
+
+ });
+
+ });
- });
-});
</script>
-
</head>
<body>
-<div id="#notification">
-
-</div>
-
-<input type="text" id="name" />
+<input type="text" name="name" id="name" />
<label for="name">Name</label>
<br />
-<input type="text" id="email" />
+<input type="text" name="email" id="email" />
<label for="email">Email</label>
-<div id="submit" style="background-color:#cccccc;">
-Send me an email
-</div>
-
+<div id="submit" style="background-color:#cccccc;">Click me to submit</div>
</body>
</html>
View
4 php.php
@@ -2,8 +2,8 @@
$name = $_POST['name'];
$email = $_POST['email'];
-
-
+
+
//Do whatever php code here that makes you happy.
mail($email, $name, "Thank you");
Please sign in to comment.
Something went wrong with that request. Please try again.