Jump to content

simple ajax doesnt work on IE


funbinod

Recommended Posts

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

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 by dsonesuk
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...