I have a column in my web design, which is periodically refreshed by a JS function “refreshColumn()” and updated by AJAX.
setInterval('refreshColumn()',60000);
function refreshColumn() {
..make call with AJAX and load response to element...
document.getElementById('myColumn').innerHTML = xmlhttp.responseText;
}
This is okay, however, it’s not very practical when my user is actually using that column and it refreshes on them!
Is it possible to modify what I have already, to incorporate an ‘onmouseover’ event that will stop the function from running the AJAX and refreshing the column, and ‘onmouseout’ allows the script to refresh again?
You would use a
timeoutinstead of aninterval, and just clear it onmouseoverand reset it onmouseout.Live Demo