Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This is the second custom function for our search. It just look sin the JSON file using jQuery getJson.
var displyResult = function(blogTitle,blogCategory,blogTags,blogLink,blogDate,blogSummary) {
var results = '<article class="posts blogpage">'+
'<h2 class="entry-title">'+
'<a class="post-link" href="'+blogLink+'">'+blogTitle+'</a>'+
'</h2>'+
'<div class="entry-summary">'+
'<p>'+
blogSummary +
'<a href="'+blogLink+'">Continued</a>'+
'</p>'+
'</div>'+
'<span class="badge blog-date">'+
'<time class="published">'+
blogDate+
'</time>'+
'</span>'+
'<div class="pull-right">';
for (var j in blogTags) {
if (blogTags[j] === null){
} else {
results = results + ' <span class="label label-primary taggedPost"><a href="/search.html?searchbox='+blogTags[j]+'">' + blogTags[j] + '</a></span> ';
}
}
results = results + '</div>'+
'</article>';
$('div#buildResults').append(results);
};
getSearchResults('/search.json');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment