The eval() function executes a string as through it were a JavaScript statement.
Syntax: eval(string)
where string is any string representing a JavaScript expression, statement, or sequence of statements. The expression can include variables and properties of existing objects.
Description
The argument of the eval() function must be a string that can also be executed as a valid JavaScript statement. If the string represents an expression, eval() evaluates the expression. If the string is a numeric sring character, eval() returns the number. If the argument represents one or more JavaScript statements, eval() performs the statements.
Example
When executed, this script

displays this on the screen:
eval(string1) = 50
eval(executable) produces
Please feel free to correct me at any point :)
AJAX calls are "asynchronous" in nature. So what does this mean? You can have multiple requests to same (or different) servlets with each request processed asynchronously. Right, so are you speaking anything new?? Yes I am :) When you make simultaneous AJAX calls to the same servlet, the last call overlaps the response text with the previous, so as a result you get only the last requet's response text i.e. HTTP requests are overlaped. I faced this this problem in one of our Project, so I thought to share some views on it.
Examples:
Traditional code:
function ajaxRequest() {
...
myRequest.onreadystatechange = callBack; // assign callback function
...
}
function callBack() {
if (myRequest.readyState == 4) {
if (myRequest.status == 200) {
// Update DOM
}
}
}
Rearranging the above code:
Now we make some rearrangement of the AJAX code so that multiple HTTP requests can go on simultaneously. To do this, the XMLHTTP request object must be instantiated inside the Javascript function that calls the server. Furthermore, all code related to the request must be inside this function. The callback function must be an anonymous inner function within the ajaxRequest() function, and the code which updates the page after the callback must also be within the anonymous inner function.
function ajaxRequest() {
...
myRequest.onreadystatechange = function()
{
if (myRequest.readyState == 4)
{
if (myRequest.status == 200)
{
// update DOM with results
}
}
} // end anonymous inner function (callback)
...
}
Doing this I was able to handle multiple AJAX calls simultaneously.
Please feel free to correct me at any point :)
I came across very nice & informative article by Greg Murray on his blog here.
He had explained the XSS attacks & how to prevent them very nicely. Really worth reading :)
Today I learnt to use Regular Expressions in JavaScript. Actually I haven't touched regular expressions from last two years. I used them two years before in Lex & Yacc programming which was solely based on REs.
It's very interesting & useful in JavaScript to make any type of validations like for float value, email address, etc. on the client side.
I tried to develop the RE for validating the float value which contains e/E in it. It was pretty interesting to see the RE coming up part by part. Finally the full fledged RE to validate float value was formed. I would like to share it:
var floatRegExp = /^([+\-])?\d*([\.])?\d*([eE]([+\-])?)?\d*$/;
Your view on the above RE is welcomed :)
Today I created one full fledged app using simple HTML, JavaScript & AJAX, which dynamically create, edit & delete the TABLE row (in the UI), which in turn is reflected in the database itself. While doing all these operations, no page REFRESH / RELOAD takes place, which gives feel that all these operations are done very faster than that of traditional approach.
As I've used JavaScript majorly, I've tested the app in IE(6.0), Mozilla Firefox(2.0.0.4) & Opera(9.20). It works fine without any browser compatibility issues. For AJAX, i've used JSON, which is supported by these browsers.
I think it's really great achievement for me as I've tried to create most user-friendly & interactive app.
Following is the snap of my app:
[All the operations takes place in the single page itself without refresh / reload]

_________________________________________________________________________________________________________________
"Look at the sky. We are not alone. The whole Universe is friendly to us and conspires only to give the best to those who dream and work."
- Dr. A P J Abdul Kalam
_________________________________________________________________________________________________________________