How to Use Link_To with Ajax in Rails 3.2.1

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



Leave a reply



Submit