Ajax callback fails (but used to work) |
[eluser]Ivoo[/eluser]
OK, this is weird. I have an jQuery ajax call-back to my CodeIgniter controller. A month ago, this worked fine. But now it stopped working. The problem is that the controller-function is not reached. Also, it is not a routing problem. When I manually point my browser to the my callback function (repository/asm), it works fine. I suspect that I unknowingly changed some configuration, or some setting. But what? Any suggestions? jQuery: Code: $.ajax({ CodeIgniter: Code: <?php // if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]InsiteFX[/eluser]
Try: Code: url: <?php echo base_url()?>+"repository/asm",
[eluser]Ivoo[/eluser]
Thanks for looking at this. I did not know you could create php-islands in jQuery like you can in HTML. Thanks for showing that. Sadly, it does not resolve the problem. Further investigations taught me that the post-request results in "NetworkError: 500 Internal Server Error - http://www.essential-strategy.com/reposi...sitory/asm" I am now trying to get support from my hoster (Dreamhost). They are usually good with support, so hopefully that will point me in the right direction.
[eluser]Ivoo[/eluser]
resolved! It turns out that this problem (ajax callback results in 500 internal server error) can be caused by the |-------------------------------------------------------------------------- | Cross Site Request Forgery |-------------------------------------------------------------------------- | Enables a CSRF cookie token to be set. The problem can be worked around by setting: Code: $config['csrf_protection'] = FALSE; in CodeIgniter's /application/config/config.php file. Don't ask me why, because I do not know. I just found an off-hand remark that pointed me in the right direction here.
[eluser]CroNiX[/eluser]
Or, you can send the csrf token along with your form... |
Welcome Guest, Not a member yet? Register Sign In |