Java Reference
In-Depth Information
On a successful request, the handleUsernameResponse() and handleEmailResponse() functions
execute. They no longer manually parse the JSON data into a JavaScript object; instead, they use the
responseJSON property:
var response = transport.responseJSON;
And finally, you register the button's click event listener using the observe() method:
$("btnSubmit").observe("click", btnSubmitClick);
exercise 2 Question
If you guessed that this question would be: “Change the answer to Chapter 14's Question 2 using
MooTools, and add error reporting for when an error occurs with the Ajax request” then you won!!
Your prize is…completing the exercise.
exercise 2 Solution
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chapter 17: Question 2</title>
<style>
.fieldname {
text-align: right;
}
.submit {
text-align: right;
}
</style>
</head>
<body>
<form name="theForm">
<table>
<tr>
<td class="fieldname">
Username:
</td>
<td>
<input type="text" id="username" />
</td>
<td></td>
</tr>
<tr>
<td class="fieldname">
Email:
</td>
<td>
<input type="text" id="email" />
</td>
Search WWH ::




Custom Search