You can keep a reference to the interval and clear it later:
$(function() {
var statusInterval;
$( "#tabs" ).tabs({
activate: function( event, ui ) {
//tried some things here
if (ui.newTab.index() == 1){
statusInterval = setInterval(function() { GetStatus(); }, 1000);
} else {
clearInterval(statusInterval);
}
}
});
});
Note that it's better to pass an anonymous function or function reference to setInterval
, rather than a string.