AJAX + RAILS Problem with ShowTooltip window effect...Routing Error in Rails
AJAX + RAILS Question. Am getting a Routing error for the following:
<div class="card-field">
<h6><imgsrc="/images/red_icon.png" width="16" alt="" align="absmiddle" class="image-3" onmouseover="ajax_showTooltip(window.event,'/quickadd_notes_help.html.erb?ranId='+Math.random(),this,'','');return false;" /></h6>
<p>Company Name:</p>
<inp开发者_如何学编程ut type="text" name="company" id="company" size="50" />
</div>
ActionController::RoutingError (No route matches "/quickadd_notes_help.html.erb" with {:method=>:post}):
Not sure what I'm doing wrong here. Both my controller and view are working fine when I go to
http://localhost:3000/cats
http://localhost:3000/cats/quickadd_notes_help
I've tried modifying my HTML in several ways!
window.event,'/quickadd_notes_help.html.erb?ranId='...
window.event,'/quickadd_notes_help?ranId='...
window.event,'/quickadd_notes_help.html?ranId='...
I have this same example working fine in a hosted non-Rails environment. But cannot seem to get this to work inside a Rails environment. My routes.rb file looks like this:
map.resources :cat
Appreciate any help you can offer!
Thanks, Sid
The action is /quickadd_notes_help
, not /quickadd_notes_help.html.erb
<div class="card-field">
<h6><imgsrc="/images/red_icon.png" width="16" alt="" align="absmiddle" class="image-3" onmouseover="ajax_showTooltip(window.event,'/quickadd_notes_help?ranId='+Math.random(),this,'','');return false;" /></h6>
<p>Company Name:</p>
<input type="text" name="company" id="company" size="50" />
</div>
Also, you should use Rails helpers whenever applicable to generate paths.
Assuming the route is called quickadd_notes_help
<div class="card-field">
<h6><imgsrc="/images/red_icon.png" width="16" alt="" align="absmiddle" class="image-3" onmouseover="ajax_showTooltip(window.event,'<%= quickadd_notes_help_path %>?ranId='+Math.random(),this,'','');return false;" /></h6>
<p>Company Name:</p>
<input type="text" name="company" id="company" size="50" />
</div>
精彩评论