[Javascript] - Ajax로 페이지 Call하는법
Javascript 2011. 6. 29. 17:12<script>
function Callajax(url){
try{
if(window.XMLHttpRequest){
tXhttp = new XMLHttpRequest();
} else if(window.ActiveXObject) {
try {
tXhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) {
try {
tXhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
}
}
}
}catch(e3){
try {
tXhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) {
try {
tXhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
}
}
}
if (tXhttp != null){
tXhttp.open("GET", url, false);
tXhttp.send();
if (tXhttp.readyState == 4) {
menuText = tXhttp.responseText;
}
}
return menuText;
}
function moviestart(lnk){
if (lnk == ""){
var url = "./movie_form.php";
}else{
var url = lnk;
}
var rtn = Callajax(url);
document.getElementById("movielist").innerHTML = rtn;
}
window.onload = function(){
moviestart("");
}
</script>
'Javascript' 카테고리의 다른 글
[Javascript] - Auto Td Row span (0) | 2011.07.07 |
---|---|
[Javascript] - Iframe Auto Resize (0) | 2011.07.01 |
[Javascript] - 동영상 제어 (0) | 2011.06.29 |
[Javascript] - 슬라이딩 터치 (0) | 2011.06.28 |
[Javascript] - 달력(심플) (0) | 2011.06.28 |