how to use link_to with ajax in rails 3.2.1
try using html
instead of update
:
$("#allclick").html("<%= escape_javascript(render(:partial => "goclick")) %>");
Rails3 - How to send Javascript Variable to a controller's action with the link_to helper?
Rails 3 no longer supports this behavior. You will have to either create a form to submit the value, or modify the href
of the link to include the value in the query string.
How to do render partial on jQuery ajax success method with rails 3
try by rendering the partial from the controller as,
def method_name
render :partial => 'some_partial'
end
and in js,
success: function(result){
jQuery("#image_center").html(result);
}
OR ELSE
create a js.erb file corresponding to that action and inside that paste the following:
jQuery("#image_center").html("<%= escape_javascript(render(:partial => 'pages/top_link')) %>");
How do i use link_to in order to link to an index controller but listing only those objects with a specific attribute?
link_to 'Widgets', widgets_path, :some_attr => 'meep'
Then, in WidgetsController#index, find_by_some_attr(params['some_attr']).
Of course, if you ask a more specific question you might get a more specific answer.
Rails 3.2.1 Form not showing in browser
Your controller for edit code might reveal the problem, the default code does only return data for HTML and JSon, so it probably returns nothing for this call. Consider always returning HTML by removing the case:
this is the default code:
respond_to do |format|
format.html # new.html.haml
format.json { render json: @shop }
end
and change that to force html to be returned by just calling render instead of this case statement.
BTW: the */*
stand for :all
Related Topics
Rails 3 - Has_And_Belongs_To_Many
Issue with Precision of Ruby Math Operations
Using Devise for More Than One Models in Rails App
Activerecord::Recordnotfound in Articlescontroller#Show Couldn't Find Article Without an Id
How to Share Image and Description Using Social_Share_Button in Rails
To_Model Delegated to Attachment, But Attachment Is Nil
Split String into Equal Slices/Chunks
+= Operator Overloading in Ruby
How to Output Leading Zeros in Ruby
Modern Tools for Ruby/Rails for Building an Achievement System
Ruby: How to Process a CSV File with "Bad Commas"
Error: Missing Rvm Environment File After Doing Rvm Upgrade Command - Passenger 4.0.23
Devise 'Find_First_By_Auth_Conditions' Method Explanation
Accessing Values Through Ajax Calls and Partials in Rails