【发布时间】:2014-07-23 20:09:59
【问题描述】:
我有索引页面,因为我有 2 个按钮“员工详细信息”和“学生详细信息” 当我点击“StaffDetails”时,“staffDetails.php”的内容应该显示在 index.php 中
同样,“STudent details”也是如此
Ajax 函数:
function search1()
{ $.ajax({
Type:'GET',
url:'StaffDetails.php',
success:function(html)
{
document.getElementById("StaffDetails").innerHTML=html;
},
})
}
【问题讨论】:
-
你有什么问题?
-
您的语法不正确...所以在 ajax 调用的末尾没有分号。 index.php 和 staffdetails.php 是否在同一目录级别?而不是 document.getElementById 使用:$("#StaffDetails").html(html);
-
那你为什么不用
$.load()呢?