Created
June 12, 2014 12:31
-
-
Save putzflorian/105148efd67a070aed61 to your computer and use it in GitHub Desktop.
Ajax polling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(typeof(Storage) !== "undefined") { | |
| var d = new Date(); | |
| var n = Math.round(d.getTime() /1000); | |
| if (sessionStorage.toralarmvisit) { | |
| } else { | |
| sessionStorage.toralarmvisit = n; | |
| } | |
| $.ajax({ | |
| type: "GET", | |
| url: urlPrefix + "/wm2014/toralarm", | |
| datatype: 'json', | |
| data: { naked: true, toralarmvisit: sessionStorage.toralarmvisit } | |
| }).done(function( msg ) { | |
| msg = JSON.parse(msg); | |
| if(msg.status){ | |
| $('#toralarminfo').html(msg.data); | |
| $('#toralarm').fadeIn(); | |
| sessionStorage.toralarmvisit = msg.tmstamp; | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment