Welcome Guest, Not a member yet? Register   Sign In
Error in URL routing
#1

[eluser]Unknown[/eluser]
Hi All,

Iam new to code Igniter. I have a problem with url's, When I submit a form from ExtJs to CodeIgniter with json request "?_dc=1201063144178" this will be appended automatically to the url as
http://domain/index.php/category/categor...1063144178.. But this Url is not routing to the categoryCombo function in category controller which gives the error 404 Page Not Found
The page you requested was not found.But it is working if "?_dc=1201063144178" is not there.Is there any solution for this?

Thanks
Rakhi....
#2

[eluser]Pascal Kriete[/eluser]
CI doesn't support GET variables. I've never used ExtJs, but you should be able to POST the necessary data instead. Also, if you have control over what gets submitted you could do ....tegoryCombo/_dc/1201063144178 which would work just fine.
#3

[eluser]cinewbie81[/eluser]
You can get GET variable if you change some setting in your config file ..
not quite remember what's the field that need to be change though !!
#4

[eluser]maesk[/eluser]
You can enable query strings in the config file application/config.php by setting $config['enable_query_strings'] to TRUE:

Quote:CodeIgniter optionally supports this capability, which can be enabled in your application/config.php file. If you open your config file you'll see these items:
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

cf. http://ellislab.com/codeigniter/user-gui.../urls.html

You could also use $this->uri->segment(2) and replace everything from the question mark to the end by nothing with something like str_replace. I haven't tried it but it should work.

PS: that is, if you don't need this part: ?_dc=1201063144178
#5

[eluser]anjelika[/eluser]
I have the same problem, did you found the best solution for this?
I don't want to enable query_strings in config file, is there any other working solution?
Thanks
#6

[eluser]adamp1[/eluser]
If you don't want to enable query_strings then you will have to either find a way to pass the data by POST, or not use it.

[quote author="inparo" date="1201094686"]I've never used ExtJs, but you should be able to POST the necessary data instead. Also, if you have control over what gets submitted you could do ....tegoryCombo/_dc/1201063144178 which would work just fine.[/quote]

This is your best option you have. Im sure in the ExtJs library you can change how a form is submited.
#7

[eluser]anjelika[/eluser]
Ah, I found the solution...you have to specify <code>method: 'POST'</code> in the HTTP request of the store in order to be treated as a POST insted of GET.
#8

[eluser]adamp1[/eluser]
Wow I just looked at ExtJs, think I may be using that. The amount of things it does, and it works with what ever javascript framework.
#9

[eluser]louis w[/eluser]
ExtJS is very nice, but pretty expensive as well.
http://extjs.com/store
#10

[eluser]Unknown[/eluser]
I found a simpler solution. In the Ex.onReady() method, add this line:

Ext.Ajax.disableCaching = false;

The _dc query string parameter is for Ext to get past client caching. Setting this to false will stop Ext from sending it.

-Tim




Theme © iAndrew 2016 - Forum software by © MyBB