The errata list is a list of errors and their corrections that were found after the product was released.
The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.
Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update
Version |
Location |
Description |
Submitted by |
Date submitted |
PDF |
Page 26
Code at bottom of the page, continuing on to page 27 |
The example code for "function httpRequest" is missing an end brace.
I have commented the missing brace in the corrected code below:
function httpRequest(url, callback, data) {
var httpObj = false;
if (typeof XMLHttpRequest != 'undefined') {
httpObj = new XMLHttpRequest();
} else if (window.ActiveXObject) {
var versions =["MSXML2.XMLHttp.5.0",
"MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0",
"MSXML2.XMLHttp","Microsoft.XMLHttp"];
for (var i=0; i < versions.length;i++) {
try {
httpObj = new ActiveXObject(versions[i]);
break;
} catch (e) {}
}
}
if (!httpObj) {
alert("Error: XMLHttpRequest not supported.");
return;
}
httpObj.onreadystatechange = function() {
if (httpObj.readyState == 4) {
if (httpObj.status != 200) alert("Error connecting to server");
else if (callback) callback(httpObj.responseText);
} // Missing brace
};
httpObj.open(data ? 'POST' : 'GET', url, true);
if (data) httpObj.setRequestHeader('Content-type','application/x-www-form-urlencoded');
httpObj.setRequestHeader("X-Requested-With", "XMLHttpRequest");
httpObj.send(data);
}
|
Brian Florence |
Apr 12, 2011 |