Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-29-2007, 05:02 PM   PM User | #1
shedokan
Regular Coder

 
Join Date: Oct 2007
Posts: 277
Thanks: 2
Thanked 4 Times in 4 Posts
shedokan has a little shameless behaviour in the past
Exclamation IE ajax error...

why do I have a problem with this script?
Code:
<script language="javascript" type="text/javascript">
<!-- 
//Browser Support Code
function createXMLHttpRequest(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
return ajaxRequest;
}
function callback(cid){ 
	if (xmlHttp.readyState==4){ 
		if(xmlHttp.status==200){
			ttop = '<table cellspacing="5" cellpadding="0" width="95%">';
			ttop = ttop+'<thead style="background-color:#DDDD00;">';
			ttop = ttop+'<tr>';
			ttop = ttop+'<td align="right" style="font-size:15pt;font-weight:bold;font-family:arial;">:חדשות</td>';
			ttop = ttop+'</tr>';
			ttop = ttop+'</thead>';
			ttop = ttop+'<tbody>';
			tfoot = '</tbody>';
			tfoot = tfoot+'</table>';
			document.getElementById(cid).innerHTML=ttop+xmlHttp.responseText+tfoot;
		}else{
			document.getElementById(cid).innerHTML="page not found: " + xmlHttp.status;
		}
	}else{
		document.getElementById(cid).innerHTML="waiting for response...";
	}
}
function ajaxFunction(id, file){
	// Create a function that will receive data sent from the server
		document.getElementById(id).innerHTML="starting...";
		xmlHttp=createXMLHttpRequest();
		xmlHttp.onreadystatechange=function(){callback(id)};
		xmlHttp.open("GET", file, true);
		xmlHttp.send(null); 
}
window.onload=function(){ajaxFunction("news", "include/news.php<?php echo $query ?>")};
//-->
</script>
<div id="news"></div>
it says "syntax error".
shedokan is offline   Reply With Quote
Old 11-29-2007, 09:51 PM   PM User | #2
rpgfan3233
Regular Coder

 
Join Date: Mar 2005
Location: D0u$h!t3 k4?
Posts: 512
Thanks: 2
Thanked 5 Times in 5 Posts
rpgfan3233 is an unknown quantity at this point
In IE7 (XP), it works fine for me, even if I force IE to use one of the Msxml2.XMLHTTP or Microsoft.XMLHTTP ActiveX objects. I wonder why it is having trouble.
__________________
PHP Code:
$hello file_get_contents('hello.txt'); echo $hello
hello
rpgfan3233 is offline   Reply With Quote
Old 11-29-2007, 11:03 PM   PM User | #3
shedokan
Regular Coder

 
Join Date: Oct 2007
Posts: 277
Thanks: 2
Thanked 4 Times in 4 Posts
shedokan has a little shameless behaviour in the past
solved!...
here's the problem I added accidently to avatars.php an onCLick="return confirm("").
shedokan is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:07 AM.


Advertisement
Log in to turn off these ads.