Here's yet another post that shows us that you don't need BASIC to be a bad coder. Some languages like Perl/PHP and JavasScript allow you to do some pretty, ummm, interesting things. Jared shares with us one of those features in JavasScript that lets you execute whatever code is stored in a string:
if (httpRequest) { // alert("httpRequest = " + httpRequest + " url = " + url + " callback = " + callback);
makeLogEntry(TITLE, fileName, "Opening get on url " + url, SUB_info); httpRequest.open('GET', url, false); // "false" in third param means synchronous
var fStr = "var callbackFunction = function () {"; fStr += " if (nCrossings && 4==httpRequest.readyState) {"; fStr += " callback(httpRequest);"; fStr += " } else {"; fStr += " }"; fStr += "}";
//alert(fStr); eval (fStr);
httpRequest.onreadystatechange = callbackFunction; var requestBody = ''; requestBody = requestBody.substring(0, requestBody.length - 1);
try { makeLogEntry(TITLE, fileName, "Sending get to url " + url,SUB_info); httpRequest.send(requestBody); } catch (e) { return badData ("can't contact database"); } }
Ahhhh ... about as useful in this context as an if (1==1) block would be.
