codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  is XMLHTTp object browser dependent?  priyatweety at 10:38 on Wednesday, August 10, 2005
 

Hi all,

alert(xmlhttp.responseText);

throughs an error System error 1072896658

I have declared the object as
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

it works for IE version 6.0.2600 but not for IE version 6.0.2800.

Pls help me

i coudnlt find out what this error means.


  Re: is XMLHTTp object browser dependent?  javabits at 18:34 on Wednesday, August 10, 2005
 

XMLHttp is not really part of the browser. It is something that is accessible to the browser. You may have different versions of XMLHttp installed which may require a slightly different way of instantiation (I believe XMLHttp is installed as part of MSXML, latest version is 4). Also the way to call it on safari and ie on macos is different also. Here's some sample js that tries to do the right thing in supporting macos/windows and the different flavors of xmlhttp.

var req;

function loadXMLDoc(url) {
  req = false;
  // branch for native XMLHttpRequest object
  if(window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch(e) {
      req = false;
    }
    // branch for IE/Windows ActiveX version
  } else if(window.ActiveXObject) {
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch(e) {
        req = false;
      }
    }
  }
  if(req) {
    req.onreadystatechange = processReqChange;
    req.open("GET", url, true);
    req.send();
  }
}

There's also a decent write up of this at the following link (where I pulled the code above also):
http://developer.apple.com/internet/webcontent/xmlhttpreq.html

semper fi...








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Nested Javascripts
•  ISP says linefeeds are causing problems
•  Linker Error Unresolved External Borland Builder 2006
•  Have multiple ASP.NET web projects share pages and controls
•  Re: How can I read ASCII data file in C++
•  Trouble writing programs
•  Validation Problem
•  Date formating from user input
•  Need help for writing javascript code global empty fields validation


Recent Articles
What is a pointer in C?
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net


© Copyright codetoad.com 2001-2006