如何在Codeigniter

时间:2017-11-09 07:21:43

标签: php ajax codeigniter

我已经从here创建了HMVC结构,并在同一模块中使用了前面板和管理面板。问题是在用户模块的admin_user中调用ajax时,它返回404 not found错误。

结构

myproject
|_ application  
  |_ modules  
    |_ user  
      |_ controllers  
         |_ User.php  
         |_ Admin_user.php 
      |_ models
        |_ User_model.php
        |_ Admin_user_model.php
      |_ views
         |_ admin
           |_ (All Admin Views)
         |_ (All Front Views)

路由

$route['admin/user']='user/admin_user';

到目前为止,我已经尝试了以下ajax网址,但没有运气它显示相同的404未找到错误。

  1. http://localhost/projects/myproject/web/admin/user/ajaxChanageStatus
  2. http://localhost/projects/myproject/web/admin_user/ajaxChanageStatus
  3. http://localhost/projects/myproject/web/user/admin_user/ajaxChanageStatus
  4. http://localhost/projects/myproject/web/user/admin/user/ajaxChanageStatus

    <script type="text/javascript">
    $(function(){
        $(document).on('click','.user-status',function(){
            var nUserId = $(this).attr('data-id');
            $.post(base_url+'admin/user/ajaxChanageStatus',{nUserId:nUserId},function(res){
                $(this).find('i').class(res);
            });
        });
    });
    

0 个答案:

没有答案