Created
September 3, 2012 20:14
-
-
Save keppy/3613037 to your computer and use it in GitHub Desktop.
Ajax call not displaying dynamic content--@invoice_reservations--the partial is rendered though.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table class="table table-bordered table-striped"> | |
<%= @invoice_reservations.each do |r| %> | |
<tr> | |
<td><%= r.name %></td> | |
</tr> | |
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show_client_invoices | |
if params[:invoice][:company_id] != "" | |
@company = Client.find(params[:invoice][:company_id]) | |
@invoice_reservations = @company.invoice_reservations | |
render :partial => 'client_reservations', :content_type => 'text/html' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> | |
<%= link_to "All Invoices", invoices_path %> | |
<% @clients.each do |c| %> | |
<li><%= link_to c.name, show_client_invoices_invoices_path(:invoice => @invoices.first. id, :company_id => "#{c.id}"), :remote => true %></li> | |
<% end %> | |
</ul> | |
</h4></p> | |
<div id="invoice_list"> | |
<%= render 'invoice_list' %> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InvoicesController < ApplicationController | |
before_filter :require_user | |
respond_to :js, :html, :json | |
def show_client_invoices | |
if params[:invoice] != "" && params[:company_id] != "" | |
@company = Client.find(params[:company_id]) | |
@invoice_reservations = @company.invoice_reservations | |
respond_with(@invoice_reservations) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#invoice_list").html("<%= escape_javascript(render(:partial => "client_reservations", :invoice_reservations => :@invoice_reservations))%>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment