igor21 Posted May 19, 2006 Share Posted May 19, 2006 hey!I have some script that works greate in IE but not works in Firefox. function isExist(url,queries){ var xmlhttp; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; }}} xmlhttp.Open('POST',url,false); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.Send(queries); var result=(xmlhttp.responseText); return result; } What's wrong?Thanks! Link to comment Share on other sites More sharing options...
aspnetguy Posted May 19, 2006 Share Posted May 19, 2006 try setting it like this var xmlHttp;if(document.all){ //IE xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}else{ //FF,Opera,NN xmlHttp = new XMLHttpRequest();} Link to comment Share on other sites More sharing options...
igor21 Posted May 19, 2006 Author Share Posted May 19, 2006 try setting it like thisvar xmlHttp;if(document.all){ //IE xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}else{ //FF,Opera,NN xmlHttp = new XMLHttpRequest();} <{POST_SNAPBACK}> still the same error in FF: "xmlhttp.Open is not a function" Link to comment Share on other sites More sharing options...
Webworldx Posted May 19, 2006 Share Posted May 19, 2006 Does: function isExist(url,queries){ var xmlHttp; try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { try { xmlHttp = new XMLHttpRequest(); } catch (e) { xmlHttp = false; }}} xmlHttp.open('POST',url,false); xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlHttp.send(queries); var result=(xmlHttp.responseText); return result; } work? Link to comment Share on other sites More sharing options...
truonghh Posted November 16, 2006 Share Posted November 16, 2006 Hi,How come it never works for me? With the code that has worked for you, it always gives me 'undefined' value. Link to comment Share on other sites More sharing options...
jesh Posted November 16, 2006 Share Posted November 16, 2006 It's open, not Open. Link to comment Share on other sites More sharing options...
boen_robot Posted November 16, 2006 Share Posted November 16, 2006 By the way, let me suggest that the scripts should first check for XmlHttpRequest() and then use ActiveX if not available. The reason is that IE7 now has native support for this object and acts faster with it. This would also increase performance in FF and Opera, scince they as well as IE7 won't try check the second code once the first it true. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now