It's not a secret anymore!
The moose likes HTML, CSS and JavaScript and the fly likes AJAX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "AJAX" Watch "AJAX" New topic


shan blossom

Joined: Sep 06, 2006
Posts: 17
I have implemented Ajax in my web application.It is working fine in Internet Explorer.How to implement Ajax in other browsers like Mozilla,Firefox etc.?Will anyone help me?
Divya Guttikonda
Ranch Hand

Joined: Mar 09, 2005
Posts: 47
Its pretty much the same i guess.See this sample

if (window.XMLHttpRequest) { // Mozilla, Safari, ...
req = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
req = new ActiveXObject("Microsoft.XMLHTTP");
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63544


There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

JavaRanch Sheriff

[Asking smart questions] [About Bear] [Books by Bear]
Wyatt Matthews

Joined: Aug 31, 2006
Posts: 3
There are several of open source javascript libraries available that will handle the implementation of the XMLHttpRequest object to ensure cross-browser compatability. Prototype.js is a good library to look into. Using a library can be helpful from the standpoint that you do not necessarily need to know all the dirty details of how the request is being created. However, it is important to understand the theory behind Ajax, and how it is supposed to be used. You can find the prototype library at

Good luck.
I agree. Here's the link:
subject: AJAX
It's not a secret anymore!