Welcome Guest, Not a member yet? Register   Sign In
Ajax url after rewrite rules
#1

[eluser]Ngulo[/eluser]
hi all ,

i'm using without rewrite enabled this type of urls on ajax scripts:

Code:
$.ajax({

            type: "POST",
            url:'<?php echo site_url();?>index.php/admin/downloads/livedownloads/',
            
etc etc....
so i'm using this beacause of i have the rewrite on

when i will turn this option on my url will return all errors :/ ??

any suggestion?

need i to create my own personals ajax url? :/
#2

[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.
#3

[eluser]Ngulo[/eluser]
i NEED CI 2 !!! Smile

but now i have always to use
Code:
echo base_url().'index.php/controller/action';
to make sure that my ,rewrite off, and ,rewrite on ,applications works toghetr at same time :/

i have now to specify in url my index.php Sad

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 Tongue
#4

[eluser]Ngulo[/eluser]
one moment man Smile

i'm a stupid,

need i to works with site_url()? Smile

i just notice that site_url('controller/action'); works greatly on both rewrite engine on and off Wink

could be this the solution? Smile
i think yes is this ehehe Smile

when rewrite is off index.php is show
when rewrite is on index.php is hide

Smile




Theme © iAndrew 2016 - Forum software by © MyBB