i try to refresh a page with ajax, but it seem javascript doesnt refreshed, i tried it 5 days already. wew... so dam it.
test to save this file with php extension.
please some one suggest me how can i change the value of javascript on ajax , thanks
test to save this file with php extension.
| Code: |
| <div id="Info">
<html> <head> </head> <? $random=rand(); echo ' <script language="javascript"> function prin'.$random.'() { alert(\''.$random.'\'); } </script> '; ?> <script language="javascript"> function refresh(){ xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { return true; } var url="test2.php"; url=url+"?sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); return false; } function stateChanged() { if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("Info").innerHTML=xmlHttp.responseText; } } function GetXmlHttpObject() { var objXMLHttp=null; if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP"); } return objXMLHttp;; } </script> <body> <? echo $random; ?> <br> <A onClick="<? echo 'prin'.$random.'()'; ?>" href="#"> test print </A> <br> <A onClick="refresh();" href="#"> Refresh </A> </body> </html> </div> |
please some one suggest me how can i change the value of javascript on ajax , thanks
