AJAX Forums

Ajax getData command failing in IE..?

This is a discussion on Ajax getData command failing in IE..? within the AJAX Questions forums, part of the Beginners AJAX category; Hi all, I'm relatively new to AJAX, and I'm attempting to populate 2 different DIV's with info from 2 different PHP files, by clicking just the one ...


Go Back   AJAX Forums > Beginners AJAX > AJAX Questions

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Old 04-20-2008, 07:50 PM   #1 (permalink)
Junior Member
 
Join Date: Apr 2008
Posts: 1
Rep Power: 0 woolyg is on a distinguished road
Ajax getData command failing in IE..?

Hi all,

I'm relatively new to AJAX, and I'm attempting to populate 2 different DIV's with info from 2 different PHP files, by clicking just the one link.

What I'm finding is that it works in Firefox (v.2.0.0.13), but not in Internet Explorer (v7)!
Here's the code I'm using - if you copy the 3 files into a folder on a testing server and open index.php in a browser (FF, then IE), you should see what I'm getting:


index.php:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Testing the GET DATA Process</title>

<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);
											}
			}
			
function pick_scorers(match_id){	
	
	 getData("firstpage.php?match_id=" + match_id + "&blank=1", 'div_1'); // Get the first set of details and put them into div_1
	 getData("secondpage.php?match_id=" + match_id, 'div_2'); // Get the second set of details and put them into div_2
	 
}
</script>
</head>
<body>

Click on <a href="javascript:pick_scorers('1')">this link</a>  to test the script. In FireFox, both of the DIVs below populate OK. In IE, only one of them does.

<div id="div_1" name="div_1"></div>
<div id="div_2" name="div_2"></div>

</body>
</html>
firstpage.php:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>

First Page

</body>
</html>
secondpage.php:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>

Second Page

</body>
</html>
Can anyone tell me why IE won't populate the relative info? It seems like it's only paying attention to the very last getData call in the pick_scorers() function - when I flip the getData calls around in the function, only the last one takes effect.

All help is appreciated, I am much confused by this one!

WoolyG
woolyg is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
is there any MOD Command in JavaScript? Murch JavaScript 1 06-01-2007 03:45 AM
What is the best css command to hide login date for myspace? CyberCrawl XHTML and CSS 1 03-28-2007 11:14 AM
Take Command with AJAX : Build WebConsole Application using Ajax Ajaxking AJAX Articles 0 12-17-2006 10:12 PM


All times are GMT -4. The time now is 08:27 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5
Copyright ©2006 - 2008, AJAXwith.com