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;
}

Recommended Answers

All 4 Replies

Do you know where it breaks? Debug with the developer tools, or put in alert()'s to find out more.

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

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;
            }`

Mark as Solved then.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.