Skip to content

Instantly share code, notes, and snippets.

@bigandy
Created November 23, 2012 11:53
Show Gist options
  • Save bigandy/4135284 to your computer and use it in GitHub Desktop.
Save bigandy/4135284 to your computer and use it in GitHub Desktop.
Solution
setInterval ( getMilk, 1000 );
var old = "";
function getMilk() {
jQuery.getJSON("/api/milk/single_milk/?dev=1",function(data) {
milkAmount = data['result']['milk-amount'];
if(old != milkAmount) {
if (milkAmount != undefined){
// console.log('not the same');
jQuery('#list').html('<h1>'+milkAmount+' ml</h1>');
}
}
old = milkAmount;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment