Skip to content

Instantly share code, notes, and snippets.

@mxriverlynn
Created June 23, 2011 02:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mxriverlynn/1041780 to your computer and use it in GitHub Desktop.
Save mxriverlynn/1041780 to your computer and use it in GitHub Desktop.
render partial to jquery template
this is a partial. <%= model.value %>
class SomeController < ApplicationController
def show
@template_model = SomeModel.new(:value => "${value}")
end
end
<html>
<head>
<script id="some-template" type="x-jquery-tmpl">
<%= render :partial => "some/partial", :locals => {:model => @template_model} %>
</script>
<script language="javascript" type="text/javascript">
$("#some-template").tmpl({value: "this is some data"});
</script>
</head>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment