Javascript 如何在php中通过load()函数调用url
我正在调用url以获取Javascript 如何在php中通过load()函数调用url,javascript,php,jquery,html,Javascript,Php,Jquery,Html,我正在调用url以获取div中的内容。我正在使用javascript函数来调用它。我正在使用这个代码 <div class="portlet" data-id="prt2"> <div class="portlet-header">Reporting</div> <div class="portlet-content" id="divEmployeeReportingWidget"></div> </div
div
中的内容。我正在使用javascript函数来调用它。我正在使用这个代码
<div class="portlet" data-id="prt2">
<div class="portlet-header">Reporting</div>
<div class="portlet-content" id="divEmployeeReportingWidget"></div>
</div>
<script>AjaxPage('../home/pages.php?page=Dashboard_EmployeeReporting', 'divEmployeeReportingWidget');</script>
报告
AjaxPage(“../home/pages.php?page=Dashboard_EmployeeReporting”,“divEmployeeReportingWidget”);
功能如下:
function AjaxPage(url, containerid)
{
$("#"+containerid).html('<br /><br /><div align="center"><img src="images/loading.gif" /></div><br /><br />');
var j = $("#"+containerid).load(url);
}
函数AjaxPage(url,容器ID)
{
$(“#”+containerid).html(“
”);
var j=$(“#”+containerid).load(url);
}
这里有page.php:
if($_REQUEST['page'] == 'Dashboard_EmployeeReporting'){
echo '<div class="portlet-content" id="divEmployeeReportingWidget"><table border="0" cellspacing="0" cellpadding="3" width="98%" align="center">
<tbody><tr><td style="width:100px;" valign="top">Report To:</td><td class="main2"><span style="font-weight:bold;"><img src="../images/icons/iconUser.gif" style="float:left"> John Smith<br></span></td></tr>
<tr><td valign="top">Reporting To Me:</td><td class="main2"><span style="font-weight:bold;"></span></td></tr>
</tbody></table></div>';
}
if($\u请求['page']=='Dashboard\u EmployeeReporting'){
回声'
报告人:约翰·史密斯
向我报告:
';
}
我无法获取内容。我如何才能做到这一点?页面名为page.php吗?您是否使用firebug或类似的工具来检查调用了哪个页面以及服务器返回了什么?我不知道如何通过这个加载函数来检查它。因为我是通过load()函数调用此页面的。请查看浏览器的开发人员工具,以查看所有请求。您必须知道您的page.php是否被调用,以及它是否返回了什么。