[Javascript] starting with ajax
Laurent Muchacho
elmuchacho at gmail.com
Mon May 8 04:57:22 CDT 2006
Hi Michael,
try this
function httpObject(){
var o;
try{
o = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
o = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
o = false;
}
}
if(!o && typeof XMLHttpRequest!='undefined'){
o = new XMLHttpRequest();
}
if(typeof o=='object'){
return o;
}else{
alert('Sorry your browser doesn\'t support the latest xml
object.');
return false;
}
}
var resObjekt = httpObject()
Laurent
On 5/8/06, Michael Borchers <list at tridemail.de> wrote:
>
> *From:* Michael Borchers <list at tridemail.de>
> *To:* javascript at LaTech.edu
> *Sent:* Monday, May 08, 2006 10:23 AM
> *Subject:* [Javascript] starting with ajax
>
>
> i use this function to create the ActiveX for Ajax and it works fine in
> FF, but IE always gets the result "null".
> guess the problem is the IE config or some SP2 prob?!
>
> if(navigator.appName.search("Microsoft") > -1)
> {
> //resObjekt = new ActiveXObjekt("Microsoft.XMLHTTP");
> resObjekt = new ActiveXObjekt("MSXML2.XMLHTTP");
>
> }
> else
> {
> resObjekt = new XMLHttpRequest();
> }
>
> alert(resObjekt);
> ok, i brought it down to these two functions, the first one works, the
> last not, though they do the same thing,
> don't they?
>
> var resObjekt;
>
> if (window.XMLHttpRequest) { // Mozilla, Safari, ...
> resObjekt = new XMLHttpRequest();
> } else if (window.ActiveXObject) { // IE
> resObjekt = new ActiveXObject("Microsoft.XMLHTTP");
> }
>
> if(navigator.appName.search("Microsoft") > -1)
> {
> resObjekt = new ActiveXObjekt("Microsoft.XMLHTTP");
> }
> else
> {
> resObjekt = new XMLHttpRequest();
> }
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060508/b390e046/attachment.htm>
More information about the Javascript
mailing list