function tipscollection_refresh(current_tip_id) { // function body defined below var mysack = new sack( "/wp-content/plugins/tips-collection/tips-collection-ajax.php?refresh¤t_tip_id=" + current_tip_id ); mysack.execute = 1; mysack.onError = function() { document.getElementById('tipscollection_randomtip').innerHTML = 'Error getting tip'; }; mysack.onLoading = function() { document.getElementById('tipscollection_nexttip').innerHTML = 'Loading...'; }; mysack.onLoaded = function() { document.getElementById('tipscollection_nexttip').innerHTML = 'Next tip ยป'; }; // mysack.onInteractive = function() { document.getElementById('tipscollection_nexttip').innerHTML += '...'; }; // mysack.onCompletion = function() { document.getElementById('tipscollection_randomtip').innerHTML = mysack.response; }; mysack.runAJAX(); return true; } // end of JavaScript function for randomtip