duanmuyao0463 2015-08-26 07:18
浏览 29

Ajax无法从应用程序的根文件夹访问目录UP中的文件

Im using this ajax call:

<script>

jQuery(document).ready(function(){
  jQuery('#compare_btn').click(function(event){
    event.preventDefault();
    var id=jQuery('#compare_btn').attr('name');
    alert(id);
    jQuery.ajax({
      type:"GET",
      data:{'propid':id},
      url: "compareAjax.php",
      success:function(result){
        alert(result);
      },
       error: function(req) {
                alert('Error: ' + req.status);
      }
    });
  });
});
</script>

The compareAjax.php contains only a

echo "working";

When i use for url : compareAjax.php and i place the file in the root folder of my site it is working as intended.

But when i move the file to: components/com_iproperty/views/compare/ and change url to "components/com_iproperty/views/compare/compareAjax.php" I get back a 500 Error from ajax request status.

Thinks i did :

  • From firebug i checked the Networking tab and the Request URL from call is correct.
  • I added both my file and folder to www-data group
  • Changed the permissions of both of em at 777

None of em worked. I moved file to components folder and changed the url of ajax also but again a 500 error pops.

Seems to be a server side issue but cant find out what. Does anyone have any idea what is going on ?

  • 写回答

2条回答 默认 最新

  • dousi1906 2015-08-26 07:20
    关注

    Change the url property as shown below.

    url: "components/com_iproperty/views/compare/compareAjax.php",
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器