Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div class="game-container"></div>
  2.  
  3. <script src="js/jquery-2.1.0.min.js"></script>
  4. <script src="js/underscore.js"></script>
  5.  
  6. <script type="text/template" class="template">
  7.  
  8.     <h2>
  9.         <%- rc.name %>
  10.     </h2>
  11.  
  12. </script>
  13.  
  14.  
  15.  
  16.  
  17. <script type="text/javascript">
  18.     _.templateSettings.variable = "rc";
  19.  
  20.     // Grab the HTML out of our template tag and pre-compile it.
  21.     var template = _.template(
  22.             $( "script.template" ).html()
  23.     );
  24.  
  25.     // Define our render data (to be put into the "rc" variable).
  26.     var templateData = {
  27.        name: "Alex"
  28.     };
  29.  
  30.     // Render the underscore template and inject it after the H1
  31.     // in our current DOM.
  32.     $( ".game-container" ).after(
  33.             template( templateData )
  34.     );
  35.  
  36. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement