AJAX Basics
Posted by Lasantha Samarakoon on August 20, 2009
Today I’m going to talk to you about, AJAX Basics. As the previous post, you can see that in the AJAX model, data transfers happen via the AJAX Engine. So the very first thing we have to do is to understand and create this AJAX engine. AJAX engine is just an object which is called as XMLHttpRequest. By creating an object of this XMLHttpRequest, you can communicate with the web server through JavaScript.
But when you try to create the object, Cross-Browser Compatibility will be an issue. Because you can’t create the object in non-Internet Explorer, in the same way as in Internet Explorer. That’s occurred because in IE, XMLHttpRequest come as an ActiveXObject, but in non-IE browsers it comes in native handler.
So here is how I going to create “XMLHttpRequest” object.

Creating XMLHttpRequest object
OK.. this is the way to create an XMLHttpRequest object. This code snippet will be working on Microsoft Internet Explorer as well as Non-IE browsers such as Mozilla Firefox, Opera, Safari or anything. By using this “http” variable, we can transmit data with the web server. I hope to show you an “Hello World” example in the next post.

Keshan said
great work Lasa keep it up. wanna learn more about AJAX and please add a few articles on JQuery, Silverlight and LINQ if possible .:)
Lasantha Samarakoon said
Thanx man… I hope to cover JQuery also. And I’ll try on LINQ, but Silverlight still I don’t have an idea man