In my rails application.html.erb, I have in javascript, an ajax post
call defined in a dom element's click method. This ajax call works fine
whenever I'm at a view that is a standard render. However, whenever I'm
at anything that is rendered using a rails partial, I get a 405 "method
not allowed" error on that ajax post. All my googling points to 405
errors commonly being caused by violating a brower's "same origin
policy" for javascript requests.
Does doing an ajax request from a rails partial really cause a "same
origin policy" violation? If so, why?
In my rails application.html.erb, I have in javascript, an ajax post
call defined in a dom element's click method. This ajax call works fine
whenever I'm at a view that is a standard render. However, whenever I'm
at anything that is rendered using a rails partial, I get a 405 "method
not allowed" error on that ajax post. All my googling points to 405
errors commonly being caused by violating a brower's "same origin
policy" for javascript requests.
Does doing an ajax request from a rails partial really cause a "same
origin policy" violation? If so, why?
if you try and break the same origin policy you shouldn't get a 405
error - the request just doesn't get made. Method not allowed means
that the method of the http request (GET, POST etc...) isn't one
allowed by the server for that URI