FD_F Posted July 18, 2009 Share Posted July 18, 2009 in firefox works perfect create object : var xmlhttp; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support XMLHTTP!"); } innerHTML to SELECT BOX placing in table function CheckUser() { check = document.getElementById("Like").value; url = "ajax.php?user="; url+= check; xmlhttp.open("GET",url,true); xmlhttp.send(null); xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { document.getElementById("add").innerHTML = xmlhttp.responseText; } } } i think its somthing how i create the object any ideas why not working ? , thanks Quote Link to comment Share on other sites More sharing options...
xenophobia Posted July 18, 2009 Share Posted July 18, 2009 Try output your responseText. var rt = xmlhttp.responseText; alert(rt); Beside, what is your "add" html element? a select list? or a div? Quote Link to comment Share on other sites More sharing options...
FD_F Posted July 18, 2009 Author Share Posted July 18, 2009 in explorer i have no output in firefox i geting <option value=test>test</option> the "add" html element is <select> inside table * even epmty alert("test"); not working inside: if(xmlhttp.readyState==4) { alert("df"); } i think its somthing how i create the object but i dont know whats wrong Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted July 18, 2009 Share Posted July 18, 2009 I've seen this before. IE wont allow an html string to be inserted inside a select element where FF does allow that. Two options you have would be to either create the option elements using document.createElement() and inject every option seperately using the appendChild() function. An easier way would be to rebuild the entire select element. The select element on your main page you can wrap inside a div so you can inject the html inside the div <div id="replaceable_select_wrap"> <select> <option></option> </select> </div> Quote Link to comment Share on other sites More sharing options...
FD_F Posted July 18, 2009 Author Share Posted July 18, 2009 thanks i did div and in the ajax.php side i give the whole <select> tag and his childs Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.