funbinod Posted May 26, 2014 Share Posted May 26, 2014 i'm learning ajax along with javascript. while learning i'm trying something as responseText. what i tried works fine on CHROME version 36(dev) but doesn't work on Internet Explorer version 11. this is what i tried <head><script type="text/javascript">var XMLHttpRequestObject = false;if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest();} else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHttp");}function getData(dataSource, divID){ if(XMLHttpRequestObject) { var obj = document.getElementById(divID); XMLHttpRequestObject.open("GET", dataSource); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { obj.innerHTML = XMLHttpRequestObject.responseText; } } XMLHttpRequestObject.send(null); }}</script></head><body><table><tr><td><a id="note" href="javascript:getData('note.php?', 'note')" class="link">Note</a></td><td id="note"></td></tr></table> please help me find what i missed........ Link to comment Share on other sites More sharing options...
dsonesuk Posted May 26, 2014 Share Posted May 26, 2014 Well it works on my crappy IE version 11 all the way to version 7. Link to comment Share on other sites More sharing options...
funbinod Posted May 26, 2014 Author Share Posted May 26, 2014 then what could have happened to my IE-11? it tries to open javascript:getData('note.php?', 'note') Link to comment Share on other sites More sharing options...
dsonesuk Posted May 26, 2014 Share Posted May 26, 2014 (edited) Just noticed, you have 2 id="note" references, when they should be unique within a page. But other than that i have have no problem calling function and retrieving content produced by note.php page. try <a href="javascript:void(null)" onclick="getData('note.php?', 'note')" class="link">Note</a> Edited May 26, 2014 by dsonesuk Link to comment Share on other sites More sharing options...
funbinod Posted May 27, 2014 Author Share Posted May 27, 2014 its still not working. it still tries to open "javascript:void(null)" Link to comment Share on other sites More sharing options...
dsonesuk Posted May 27, 2014 Share Posted May 27, 2014 Produce a link to file, or jsfiiddle it, it should and does work in IE11. Either that or you have saved it as ANSI instead of UTF-8 encoding. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now