Created
October 10, 2012 15:57
-
-
Save davidrhoden/3866532 to your computer and use it in GitHub Desktop.
all values are coming out 'undefined'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var projectsJSON = $.getJSON( 'jsondata.json', function() { | |
alert("success" + projectsJSON.responseText); //this returns the JSON, pretty sure it is well-formed | |
}); | |
var portfolio = '<% _.each(projectsJSON, function(projects,index) { %><div id="<%= projects.iimage %>" class="anImage <%= (index)== 0 ? "active visible" : "hidden" %>"><a class="lightbox" href="/images/lightboxed/<%= projects.iimage %>"> <img src="/images/<%= projects.iimage %>" width="844"></a><div class="explanatory_copy"><div class="project_name"><%= projects.pproject_name %></div><div class="project_subtitle"><%= projects.pproject_subtitle %></div><div class="description"><p><%= projects.pproject_desc %></p></div><div class="link_to_more"><a href="<%= projects.iproject %>" rel="address:/<%= projects.iproject %>"><%= projects.ilink_to_more_copy %></a></div><div class="description_more"><p><%= projects.iimagedesc %></p></div></div></div> <% }); %>'; | |
var templateOutput = _.template(portfolio, { projects : projectsJSON }); //this is the line I think is probably wrong | |
$('.slides_container').html(templateOutput); | |
//I get 'undefined' for all the interpolated values when I output the template |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment