drix47193 2011-07-03 14:34
浏览 124
已采纳

外部HTML内容的AJAX加载在localhost上完美,但在服务器上不起作用

I am trying to render content generated by a php file in [jQuery Colorbox][1] through AJAX in my WordPress site. The PHP resides on the same server in the same domain. It works perfect when I run it on localhost but it's not working on the server.

Here is the link to my site - http://shabdcreatives.com/portfolio

The links themselves are not invalid, for example the following link works fine on its own:

http://shabdcreatives.com/wp-content/plugins/catgrid/includes/CatGridPost.php?ID=33

I just won't open inside the colorbox.

Also the php file I am trying to load is just a fragment and DOES NOT CONTAIN any <html> or <body> tags.

I tried the colorbox support group but no replies from them yet

This is the code in the CatGridPost.php file that i am calling in the colorbox.. i tried calling a plain text file too... it returned no error.. but the colorbox did not show its contents either

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>          

  • 写回答

2条回答 默认 最新

  • dszdiavv474681 2011-07-03 16:16
    关注

    Hi it can be a server issue with mod_security , i had a similar issue with one of my clients server i disabled the mod_security and it solved the issue.

    But i was not getting an 404 error.

    here is the link for reference http://drupal.org/node/370651

    Also try changing the file permission : /wp-content/plugins/catgrid/includes/CatGridPost.php

    If it is a Wordpress whydont you try the inbuilt Ajax function of wordpress

    http://codex.wordpress.org/AJAX_in_Plugins

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型