Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AJAX

 
shan blossom
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 65114
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"blossoms",

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.

Thanks!
bear
JavaRanch Sheriff
 
Wyatt Matthews
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 http://prototype.conio.net/.

Good luck.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic