403禁止从ajax请求访问CodeIgniter控制器 [英] 403 Forbidden Access to CodeIgniter controller from ajax request

查看:442
本文介绍了403禁止从ajax请求访问CodeIgniter控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Im在向codeigniter控制器发送ajax请求时遇到问题。它抛出一个404 Forbidden Access错误。我发现了一些类似的问题,但我不知道如果其特定的CodeIgniter框架,还有解决方案给在那个线程没有解决我的问题。下面是我的ajax请求。我想知道这可能是因为CI应用程序文件夹的根文件夹的.htaccess,但我不想更改其默认配置。

Im having trouble with sending an ajax request to codeigniter controller. It is throwing back a 404 Forbidden Access error. I have found some sort of similar question to this but im not sure if its particular to CodeIgniter framework, and also the solution give in that thread did not solve my problem. below is my ajax request. Im wondering this is probably because of the .htaccess of the root folder of CI Application folder, but i dont want to change its default configuration yet.

发送ajax请求CI控制器的正确实现方法?如果没有,任何建议。谢谢!

Is sending ajax request to CI controller the correct way of implementing this? if not, any suggestion please. Thanks!

var ajax_load = '{loading gif img html}';
var ajax_processor = 'http://localhost/patientcare-v1/application/controller/ajax_processor/save_physical_info';

$("#save").click(function(){
    $("#dialog-form").html(ajax_load);
    $.post(
        ajax_processor,
        $("#physical-info").serialize(),
        function(responseText){
            $("#dialog-form").html(responseText);
        },
        "json"
    );
});


推荐答案

移除< code> ; $

var ajax_processor = 'http://localhost/patientcare-v1/index.php/ajax_porcessor/save_physical_info';

如果您隐藏 index.php 使用 url

var ajax_processor = 'http://localhost/patientcare-v1/ajax_porcessor/save_physical_info';

这篇关于403禁止从ajax请求访问CodeIgniter控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆