Shouvik-S-Mazumdar wrote:
> 
> hi ,
> 
> well i have searched a lot for this , perhaps i am just unlucky enough   not
> to hit the bulls eye , so i ask again in this forum ...
> 
> 
> Well i am using  jquery for calling a remote function . I am also using the
> CODEIGNITER MVC . i write something like this :
> 
> 
> $.post("index.php/login/ajaxlogin" , {email : username , pass : password } ,
> function(data) 
>                               {  
> 
> 
>                                          //  CODE HERE
>                                  
> 
> 
> 
> 
>                                  }
> 
> 
> 
> 
> Now lets say my url  is  : www.XYZ.com/index.php/welcome
> 
> 
> if i directly type thus URL in the adress bar and press enter .. my ajax
> call doesnt work :(   . however if i reach at the same url following a
> hyperlink somewhere in my website  the ajax routine works  perfectly !
> 
> The error in  the first case : 
> 
> Access to restricted URI denied" code: "1012
> 
> 
> 
> I have tried every possible way to sort this matter out. i am not on my
> development pc but on a web server .  
> 
> please do  help me out ...
> 
> 
> 

I'm also using codeigniter, and I like to write the ajax call with the
CodeIgniter's URL helper:

$.post("<?php echo site_url('/login/ajaxlogin'); ?>"
      ,{email : username , pass : password }
      ,function(reply) {
        //CODE HERE
      });

This only work if the page also served by CodeIgniter's controller.

If it from external page, you must put the complete url:
http://domain.com/<somedir>/index.php/login/ajaxlogin

I'm never had problems with CodeIgniter and AJAX call using jQuery.

--
Donny Kurnia
http://hantulab.blogspot.com
http://www.plurk.com/user/donnykurnia

Reply via email to