H
helzer
Hi,
I'm completely new to Ruby/Rails, so sorry for asking newbi questions.
I'm just following the Agile Web Development book, and got to the AJAX
section.
Added the code from the web, to generate the .js which triggers the
AJAX, but no .js code appears in the HTML.
This is what I've added to the .rhtml code (from the book):
__________________
<% for product in @products -%>
<div class="entry">
<img src="<%= product.image_url %>"/>
<h3><%= h(product.title) %></h3>
<%= product.description %>
<span class="price"><%= number_to_currency(product.price) %></span>
<% form_remote_tag :url => { :action => :add_to_cart, :id =>
product } do %>
<%= submit_tag "Add to Cart" %>
<% end %>
<br clear="all"/>
</div>
<% end %>
__________________
Surprisingly, the HTML source that I see in the browser doesn't contain
any .js code. This is what I'm getting:
__________________
<div class="entry">
<img
src="http://www.onthegosoft.com/images/printer/passport_photo_small.png"/>
<h3>Passport Photo</h3>
Our great program for making passport picture!
<span class="price">$9.95</span>
<br clear="all"/>
</div>
<div class="entry">
<img
src="http://www.onthegosoft.com/images/photobackup/photo_backup_small.png"/>
<h3>Photo Backup</h3>
<p><b>Great program</b> for backing up <b>digital photos</b>.</p>
<span class="price">$29.95</span>
<br clear="all"/>
</div>
__________________
Notice, just before the <br> tag at the end, a .js snippet should
appear, triggering the AJAX.
Any advice how I can debug this?
Thanks,
Amir
I'm completely new to Ruby/Rails, so sorry for asking newbi questions.
I'm just following the Agile Web Development book, and got to the AJAX
section.
Added the code from the web, to generate the .js which triggers the
AJAX, but no .js code appears in the HTML.
This is what I've added to the .rhtml code (from the book):
__________________
<% for product in @products -%>
<div class="entry">
<img src="<%= product.image_url %>"/>
<h3><%= h(product.title) %></h3>
<%= product.description %>
<span class="price"><%= number_to_currency(product.price) %></span>
<% form_remote_tag :url => { :action => :add_to_cart, :id =>
product } do %>
<%= submit_tag "Add to Cart" %>
<% end %>
<br clear="all"/>
</div>
<% end %>
__________________
Surprisingly, the HTML source that I see in the browser doesn't contain
any .js code. This is what I'm getting:
__________________
<div class="entry">
<img
src="http://www.onthegosoft.com/images/printer/passport_photo_small.png"/>
<h3>Passport Photo</h3>
Our great program for making passport picture!
<span class="price">$9.95</span>
<br clear="all"/>
</div>
<div class="entry">
<img
src="http://www.onthegosoft.com/images/photobackup/photo_backup_small.png"/>
<h3>Photo Backup</h3>
<p><b>Great program</b> for backing up <b>digital photos</b>.</p>
<span class="price">$29.95</span>
<br clear="all"/>
</div>
__________________
Notice, just before the <br> tag at the end, a .js snippet should
appear, triggering the AJAX.
Any advice how I can debug this?
Thanks,
Amir