Jump to content

[SOLVED] IE ajax error...


shedokan

Recommended Posts

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".

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.