I tried to retrieve data through a live server and display them through my local web application, the code to fetch the data by the user`s levels.
How I can sort them either by their levels or views entry.heat
?
The levels or views entry.heat
are values in the server and both are variables, so kindly check the below code in order to sort by entry.heat
.
function(r){
var max = $('#limit').val();
if (r.data.video_info.length < max) max = r.data.video_info.length;
for (index = 0; index < max; index++) {
var entry = r.data.video_info[index];
var level = parseInt(entry.level);
if ((level > $('#min').val()) && (level < $('#max').val())) {
count++;
var h = '<div class="entry '+(entry.sex==0?'female':'male')+'"><img src="'+entry.smallcover+'">'+'<span>Heat:<span>'+entry.heat+'</span></h3>';
$('#main').append(h);
}
}
if ((current_page < 100) && (count < $('#limit').val() )) {
current_page++;
setTimeout(function(){
doSearch();
},0);
}
}
});