Skip to content

Instantly share code, notes, and snippets.

@insightcoder
Last active October 7, 2017 04:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save insightcoder/677c5a58cbea1205b78e538270f3dc6f to your computer and use it in GitHub Desktop.
Save insightcoder/677c5a58cbea1205b78e538270f3dc6f to your computer and use it in GitHub Desktop.
var results_template = null;
function render_results(search_term, results) {
var num_results = Object.keys(results).length;
var html = results_template({
"search_term": search_term,
"num_results": num_results,
"has_results": num_results > 0,
"results": results
});
return html;
}
$(document).ready(function() {
// ... Other setup ...
var results_script = $('#results-template').html();
results_template = Handlebars.compile(results_script);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment