My goal is to continuously update the current time every minute using a countdown timer. Unfortunately, my code seems to be malfunctioning as indicated by an error message in the Firebug console stating that the function getStatus()
is not defined. How can I properly call this function at regular intervals?
jQuery(document).ready(function($){
$(function() {
getStatus();
});
function getStatus() {
var post_id = $('#post_id').val();
var nonce = $('#_wpnonce').val();
jQuery.ajax({
url : ajaxurl,
data : {action: "update_edit_lock", post_id : post_id, nonce: nonce },
success: function(response) {
if(response == "false") {
alert("failed")
}
else {
$("#message").html(response)
}
}
});
setTimeout("getStatus()",60000);
}
}, (jQuery));