Vote count:
0
I'm working on this project for learning purposes. The tasks for now are very simple:
- Populate data from DB using
$.getJSON. - Check every
'n'seconds for new data andappendit to the list. - Notify user about new data changes.
Here is the example of where I got so far: ( JSBin ) All the issues will be visible when running the example.
Here is the JS code that i have:
$(document).bind('pageinit', function(){
var $myList = $( "#myList" );
var newItems = [];
function loadList(){
$.getJSON("http://ift.tt/1uOXJIa",function(data){
$.each(data, function( index, value ) {
newItems.push( "<li><a>" + value.airline + "</a></li>" );
if(data>newItems){
alert('New Entry');
data=newItems;
}
});
$myList.append( newItems.join( "" ) );
$myList.listview( "refresh" );
setTimeout(loadList,1000);
});
}
loadList();
});
Thanks for your help !
asked 15 secs ago
jQuery Mobile load new data only
Aucun commentaire:
Enregistrer un commentaire