![]() |
# 1 |
חסום
|
בעיה פשוטה ברענון ב ajax
ajax.js
קוד:
function createRequestObject() { var ro; if (window.XMLHttpRequest){ try { ro = new XMLHttpRequest(); } catch(e) { ro = false; } } else if(window.ActiveXObject){ try{ ro = new ActiveXObject("Msxml2.HTMLHTTP"); } catch(e) { try{ ro=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { ro = false; } } } return ro; } var http = createRequestObject(); function ajax(url,target) { http.open('GET', url,true); http.onreadystatechange = handleResponse(target); http.send(null); } function handleResponse(target) { if(http.readyState == 4){ var response = http.responseText; document.getElementById(target).innerHTML=response } } window.onload=function(){ setTimeout("ajax('index.php','output')",1000); } קוד:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="JavaScript" src="ajax.js" type="text/javascript"></script> <title>Hello!</title> </head> <body> <div id="output"></div> </body> </html> index.php קוד:
<?php header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); echo "bla"; ?> למשל עכשיו כתוב bla ושיניתי ל bla1 זה לא מציג bla1 עד שאני לא מרענן את הדף |
![]() |
חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים) | |
|
|