Sunday, September 27, 2009

Routing related issue

I encountered an issue related to routing which I hope someone can
help me understand.
I have a controller called publishers and an action called search. In
this search view I have an ajax form which upon change to the form
select, calls an action to get the options for a second form select.
When I access this page via /publishers/search, the ajax form works
fine without any issue.

I also have an entry in the route.php that routes /publisher-network
to /publishers/search. The routing works fine and takes me to the /
publishers/search view. However my ajax form breaks with a 404 not
found error. I believe it has something to do with routing that I
have not come to understand yet.

My jQuery ajax part is as follows:

$.ajax({
type: "POST",
url: 'update_city_select',
data: "ajax=true&state_id="+selected,
success: function(msg){.....}
});

If I change the url part to 'publishers/update_city_select', it will
work fine. But then again, it will give the same error when I access
the page directly via "publishers/search". I'm trying to find a way
that will work for both situation if possible.

Thanks in advance for your help.
Steve
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: