Sam Wilder
Sam Wilder

Reputation: 879

Routing Error - No route matches on AJAX call

I know there have been a lot of submissions about routing error, but even after going through many of those and looking at routing guide, I am not able to figure out my issue.

I have created a Ajax submission of form like -

$('#user_time_zone').live('change', function() {    
  $(this).parents('form:first').submit();
});

However, on the event, I am getting the Routing Error

No route matches '/user/time_zone'

My routes as such shows

user_time_zone POST   /user/time_zone(.:format)           {:controller=>"user", :action=>"time_zone"}

In routes file I have entry like -

match 'user/time_zone' => 'user#time_zone', :via => [:post]

What might I be doing wrong.

Upvotes: 0

Views: 1587

Answers (2)

vladdruzh
vladdruzh

Reputation: 208

Maybe you send a form with method GET
or
There is hidden field in form _method=put

Can you post request log from development.log and view with form?

Upvotes: 2

sameera207
sameera207

Reputation: 16629

Try running

rake routes 

and see all your routes are captured,

and if you could paste your routes, we might be able to help you

thanks and regards

sameera

Upvotes: 0

Related Questions