0

Hey DW fellas
I'm having some trouble when I run my code on IE. I tried it on Chrome and Firefox and it works, but it doesn't at IE. I think that is a Javascript problem, but I can't find the solution. So please, if you can give me a clue of the problem and how to resolve it I'll be so greatful.
Basiclly I need to know if some function on this code is non compatible with IE.
Variables' names are in spanish, because that's my native language :P
See ya!

var conexion1=crearXMLHttpRequest();
/*
    This code brings the mysql query results and insert them into a div called "prods"
*/
function vercont_prods(nro) 
{
  var url='';
  url='ver.php?id='+nro;
  conexion1.onreadystatechange = procesarEventos;
  conexion1.open("GET",url,true);
  conexion1.send(null);
}

function procesarEventos()
{
  if(conexion1.readyState == 4)
  {
    var cont_prods = document.getElementById("prods");
    cont_prods.innerHTML='';
    cont_prods.innerHTML = conexion1.responseText;
    cont_prods.focus();
  } 
  else 
  {
    cont_prods.innerHTML = 'Loading...';
  }
}

function crearXMLHttpRequest() 
{
  var xmlHttp=null;
  if (window.ActiveXObject) 
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  else 
    if (window.XMLHttpRequest) 
      xmlHttp = new XMLHttpRequest();
  return xmlHttp;
}
3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by ko ko
1

Probably, you may have XMLHTTPRequest problem. Are you sure crearXMLHttpRequest() works on IE and you get new XMLHTTPRequest ? Should try what @pritaeas said.

0

Zero13 thank you so much! You were right, createXMLHttpRequest() was wrong, it doesn't work properly. My code now is
`

function crearXMLHttpRequest() 
            {
                var xmlhttp;
                if (window.XMLHttpRequest)
                {
                    xmlhttp=new XMLHttpRequest();
                }
                else
                {
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
              return xmlhttp;
            }`
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.