我正在尝试通过 AJAX 在我的 WordPress 站点中呈现由 [jQuery Colorbox][1] 中的 php 文件生成的内容。 PHP 驻留在同一域中的同一台服务器上。当我在本地主机上运行它时,它工作得很好,但它在服务器上不工作。
这是我网站的链接 - http://shabdcreatives.com/portfolio
链接本身不是无效的,例如以下链接本身就可以正常工作:
http://shabdcreatives.com/wp-content/plugins/catgrid/includes/CatGridPost.php?ID=33
我只是不会在 colorbox 里面打开。
此外,我尝试加载的 php 文件只是一个片段,不包含任何 <html>
或 <body>
标签。
我尝试了 colorbox 支持小组,但还没有他们的回复
这是我在 colorbox 中调用的 CatGridPost.php 文件中的代码。 我也尝试调用一个纯文本文件...它没有返回任何错误...但是颜色框也没有显示其内容
require_once("../../../../wp-blog-header.php");
$thepost = get_post($_GET["ID"]);
$thecontent = $thepost->post_content;
$thetitle = $thepost->post_title;
$thelink = get_permalink($_GET["ID"]);
?>
<div id="cg-post-container">
<div id="cg-post-title">
<a href="<?php echo $thelink; ?>"><?php echo $thetitle; ?></a>
</div>
<div id="cg-post-content">
<?php echo $thecontent; ?>
</div>
最佳答案
您好,这可能是 mod_security 的服务器问题,我的一个客户端服务器也有类似的问题,我禁用了 mod_security,它解决了这个问题。
但我没有收到 404 错误。
这里是引用链接http://drupal.org/node/370651
也尝试更改文件权限:/wp-content/plugins/catgrid/includes/CatGridPost.php
如果是 Wordpress 为什么不试试 wordpress 内置的 Ajax 功能
关于php - 外部 HTML 内容的 AJAX 加载在本地主机上运行完美,但在服务器上运行不佳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6563509/