elabuwa Posted October 24, 2011 Share Posted October 24, 2011 Hi guys, below is the piece of code, I'm using for some simple ajax stuff. However, IE8 gives a warning and the script does not work, but it works in chrome & FF. Any help is greatly appreciated coz i'm bamboozled with this. http = getHTTPObject(); function getHTTPObject(){ var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }catch(E){ xmlhttp = false; } } @else xmlhttp = false; @end @*/ if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){ try { xmlhttp = new XMLHttpRequest(); }catch(e){ xmlhttp = false; } } return xmlhttp; } function show_media_type(pub_type){ var url = "get_media.php?media_type=" + pub_type; http.open("GET", url, true); http.onreadystatechange = showmedia; http.send(null); } function confirm_media(){ if(http.readyState == 4){ [b]document.getElementById('header').innerHTML = http.responseText;[/b] } } function showmedia(){ if(http.readyState == 4){ [b]document.getElementById('publications').innerHTML = http.responseText;[/b] } } function test(pid){ if(pid.length==0){ pid = "test"; } alert(pid); } function selected_media(pid){ var url = "confirm_media.php?media_id=" + pid; http.open("GET", url, true); http.onreadystatechange = confirm_media; http.send(null); } IE8 error displaying this highlights the bolded lines above as to have issues and script stops working. To see the entire thingi in action, please check dpmentor.com/gary use "test" as username and password and click on "Publications" button. If you use IE8, the error section on the bottom left will comeup and when clicked on will show the error. I really appreciate any help. Regards, Elabuwa Quote Link to comment Share on other sites More sharing options...
elabuwa Posted October 24, 2011 Author Share Posted October 24, 2011 sorry, just came to know that the bolded ones are not effected i think coz they are inside the "code" tags. The line that gives the error is apparently : document.getElementById('header').innerHTML = http.responseText; Quote Link to comment Share on other sites More sharing options...
elabuwa Posted October 25, 2011 Author Share Posted October 25, 2011 thanks for the help. i got it sorted. In case any one faces an issue likes this, it was the "id" names. Apparently IE thinks in some wierd way id takes the name and id in some elements as the same. look for text "publications" in the code and you will see what I mean. 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.