For getting content from another page you only need 3 functions
javascript
JavaScript:
function showDetails(){ xmlHttp=GetXmlHttpObject() if (xmlHttp==null){ alert ("Browser does not support HTTP Request") return } var url="javascript/result/auto.php" url=url+"?q=te" xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) }
JavaScript:
function GetXmlHttpObject(handler){ var objXMLHttp=null if (window.XMLHttpRequest){ objXMLHttp=new XMLHttpRequest() }else if (window.ActiveXObject){ objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") } return objXMLHttp }
JavaScript:
functionstateChanged(){ if (xmlHttp.readyState==4){ if(xmlHttp.status == 200){ document.getElementById("booja").innerHTML=xmlHttp.responseText }else{ alert("Problem with request!"); } } }
html
HTML:
Click<span style="cursor: pointer; color: green" onclick="showDetails()">this</span> to fill the div
The output of this php page "javascript/result/auto.php" will be shown in the "booja" div.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Nov | ||||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 | |
RSS feed for comments on this post · TrackBack URI
Leave a reply