Forum Moderators: open

Message Too Old, No Replies

AJAX working in FF but not in IE

object required error

         

guzman

5:59 pm on Aug 13, 2008 (gmt 0)

10+ Year Member



HI all , i am almost crazy looking where to find and solve a problem but ith any success...
i will explain:
i am trying to make a form that when i select an item in from a list this brings me some info and fill all the fields of the form.
i am using php,mysql,ajax,xml
in my form page i have the ajax object created for ie and the rest of the explorers, it also have de function that send to an other page the selected value. This page process making a query on mysql and delivers an xml, that is send to the first page.
i use the responseXML to obtain that data and fill the fields of the form. In fire fox works perfectly, but on ie it doesnt the error that appears is Object requires after the line where i ask the responseXML....

here is part of the code


function nuevoAjax(){
//xmlhttp = false;
try
{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E) {
xmlhttp=false; }
}
if (!xmlhttp&&typeof XMLHttpRequest!='undefined'){
xmlhttp=new XMLHttpRequest();
// xmlhttp.overrideMimeType('text/xml');
}
return xmlhttp
}
var ajax=nuevoAjax();
ajax.open("POST", "ej2.php", true);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded charset=ISO-8859-1');
//alert(cod);
ajax.send("v="+_cod);
ajax.onreadystatechange=function()
//alert(ajax.send());
{
if (ajax.readyState == 4)
{
var respuesta=ajax.responseXML;
//var respuesta2=ajax.responseText;
}
}

i will apreciate a lot any help!

[edited by: DrDoc at 6:17 pm (utc) on Aug. 13, 2008]
[edit reason] Reduced sample code a lot. [/edit]

Fotiman

1:57 pm on Aug 14, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What is the mime type of the XML that you are returning? I believe IE needs this to be "text/xml"