Learn AJAX

Asynchronous JavaScript And XML: A to Z blog…

  • Lasantha Samarakoon

  • Facebook

  • Advertisements

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

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 httpvariable, we can transmit data with the web server. I hope to show you an “Hello World” example in the next post.


2 Responses to “AJAX Basics”

  1. 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 😦

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: