Skip to content

Instantly share code, notes, and snippets.

@thotbox
Created September 11, 2014 13:01
Show Gist options
  • Save thotbox/53265053d0120467d532 to your computer and use it in GitHub Desktop.
Save thotbox/53265053d0120467d532 to your computer and use it in GitHub Desktop.
Ping Pong Compare Timestamps
// Ping Pong Compare Timestamps
setInterval(function () {
fetchEditDate('/fetch/edit-date/{segment_2}');
var origEditDate = $('#original-edit-date-field').val();
var fetchedEditDate = $('#fetched-edit-date-field').val();
if (fetchedEditDate > origEditDate){
location.reload();
}
},500);
function fetchEditDate(page_url){
$.ajax({
url:page_url,
success:function(data){
$('#fetched-edit-date').html(data);
$('#fetched-edit-date-field').val(data);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment