Ruby on Rails Thursday, January 31, 2013

Hi All,

A question on using javascript within a view to render a partial. Been
struggling wit this for a bit.
I've multiple partials in my views and I want to replace them within a
specific div, how do I get this variable 'page' within the
escape_javascript and replace it with 'reviews' so I can render the
other pages (Such as specials, gallery, etc) within that div.

Thanks. Appreciate the help!
Below is the code snippet.

<script type="text/javascript">

$(function(load_content) {
$("#reviews, #specials, #gallery, #location, #contact,
#about").click(function() {
var page = this.id;
//alert (page);

$.pageslide.close();
var content = "<%= escape_javascript(render(:partial =>
'reviews')) %>";
$("#content").html(content);
})
})
</script>

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment