Thank you for your guidance but i am stuck here i am unable to use
getScript properly
After executing my code
In views home.html.erb:
$(document).ready(
function() {
$(".inline").click(function() {
currentCellText = $(this).text();
$('.dynamic').load('/test',{foo1: currentCellText});
});
});
routes.rb:
match '/test', to: 'sessions#some_action'
controller code:
def some_action
@object = Class.where(some_condition)
respond_to do |format|
format.js
end
some_action.erb
$(".dynamic").html("<%= escape_javascript(render(:partial => 'partial',
:locals => {:object => @object})).html_safe %>");
my partail _partial.html.erb
<ul id="myMenu" class="contextMenu">
<ul id="mixed">
<li><%="My Events"%>
<ul>
<li><span>
<%@object.each do |k|%>
<li><%=k%></li>
<%end%>
</span></li>
</ul>
</li>
</ul>
Present output
$(".dynamic").html("
\n
\n
My Events\n
\n
\n <\/span><\/li>\n <\/ul>\n <\/li>\n
Please guide me how to use getScript(), is there any example for this.
And onClick i have to refresh my partial with @object values and display
it
in html.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.