我的 index.php
switch ($action){
case "calendar":
echo "<script language=\"javascript\">\n";
echo "document.write('Hello World!')";
echo "</script>";
include($_STR_TEMPLATEPATH."/calendar_view.php");
break;
}
我的 calendar_view.php:
我有一个 ajax 函数,它应该调用fromaction
calendar
并index
显示结果calendar_view.php
calendar div
<script>
function calendarList()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
document.getElementById("calendar").innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("GET","?action=calendar",true);
xmlHttp.send(null);
}
</scritp>
日历 div:
<div id="calendar"></div>
当我调用它时,calendarList function
它确实调用了案例,但没有在calendar div
.
任何帮助。谢谢