![]() |
Ajax url after rewrite rules - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Ajax url after rewrite rules (/showthread.php?tid=34639) |
Ajax url after rewrite rules - El Forum - 10-05-2010 [eluser]Ngulo[/eluser] hi all , i'm using without rewrite enabled this type of urls on ajax scripts: Code: $.ajax({ when i will turn this option on my url will return all errors :/ ?? any suggestion? need i to create my own personals ajax url? :/ Ajax url after rewrite rules - El Forum - 10-05-2010 [eluser]WanWizard[/eluser] You should never include index.php hardcoded in your URL's. In the application config/config file, you have to define both the "base_url" and the "index_page". If set properly, the CI helpers will generate the correct URL. From a URL point of view, it doesn't really matter if it's an ajax request or not. If you want to make sure the ajax URL isn't typed in in the browser, check for ajax in your method (hint: search for IS_AJAX). For ExiteCMS, we use a different front controller (ajax.php instead of index.php). In CI 2.0 you can do this and bypass routing by calling a fixed controller (in our case the controller ajax.php) which validates all ajax calls and if valid passes the request on to a module controller. Ajax url after rewrite rules - El Forum - 10-05-2010 [eluser]Ngulo[/eluser] i NEED CI 2 !!! ![]() but now i have always to use Code: echo base_url().'index.php/controller/action'; i have now to specify in url my index.php ![]() my config are as shown: $config['base_url'] = "http://localhost/ASD/"; $config['index_page'] = "index.php"; when enabling rewrite engine i have to specify index.php after base_url() echo :/ i think ,guessing, that my config params are right ![]() Ajax url after rewrite rules - El Forum - 10-05-2010 [eluser]Ngulo[/eluser] one moment man ![]() i'm a stupid, need i to works with site_url()? ![]() i just notice that site_url('controller/action'); works greatly on both rewrite engine on and off ![]() could be this the solution? ![]() i think yes is this ehehe ![]() when rewrite is off index.php is show when rewrite is on index.php is hide ![]() |