AJAX request returns a 403 error |
[eluser]Fyodor[/eluser]
Hello I am receiving 403 error when I am trying to request Php function from model through AJAX: Ajax is: Code: $(function() { Php function is Code: public function ReturnUsers(){ When I am typing characters in input field, AJAX request returns the 403 error: ----- 403 Forbidden http://localhost/Meetings_site/applicati...s?term=abc ----- When I am trying to open these model function directly from URL (copy URL in browser) I receive permission error: ------ Forbidden You don't have permission to access /Meetings_site/application/models/meetings_model/ReturnUsers on this server. ------ I suspect that I need to edit .htaccess file, but I can not understand what parameters I need to change. Could you help me to resolve it? Thank you in advance! Fyodor
[eluser]CroNiX[/eluser]
You have to access a controller/method, and the controller can access a model. Just like all other pages. You can't directly access anything in /system or /application directly from the url for security purposes. It would be best to not alter that behavior unless you understand the ramifications. So, create a new controller or use an existing one, and create a new method which loads your model and executes the ReturnUsers() method. Code: function get_users() Then change the url for your ajax call: Code: url: "http://www.yoursite.com/the_controller/get_users", See: http://ellislab.com/codeigniter/user-gui.../urls.html
[eluser]Fyodor[/eluser]
Hello CroNix You advice was helpful: Now I am using controller method in ajax request and it works. Thank you! Fyodor |
Welcome Guest, Not a member yet? Register Sign In |