I'm trying to re-write this function to ajax in js file:
function generateSearchItems(response) {
$("#content *").remove();
var html = '<ulclass="items">';
for(item in response) {
html += '<liclass="item clear">';
// Shot thumbnail
if (response[item].thumbnailDir) {
html += '<divclass="thumbnail">';
html += '<ahref="#"><imgsrc="' + response[item].thumbnailDir + '"width="155px"height="115px"></a></div>';
}
html += '<divclass="description"><divclass="desc-head">';
html += '<h3><ahref="' + response[item].link + '">' + response[item].post_title + '</a></h3>';
// Show rating
if (response[item].rating) {
html += '<divclass="item-rating">';
for (var i = 1; i <= response[item].rating['max']; i++) {
if (i <= response[item].rating['val']) {
html += '<divclass="star active"></div>';
} else {
html += '<divclass="star"></div>';
}
}
html += '</div>';
}
html += '</div></div></li>'
}
html += '</ul>'
$("#content").append(html);
}
I stopped on this step and don't know how rewrite this piece of code: