Update server side code from client side on interval


// unique global variables for each interval
var num1;
var num2;
var num3;


// start each interval on page load
dojo.addOnLoad(function(){
	num1 = setInterval("updateID('computedField1','num1');",10000);
	num2 = setInterval("updateID('computedField2','num2');",15000);
	num3 = setInterval("updateID('computedField3','num3');",22000);
});


// Update the id using partial refresh
function updateID(idname, num){
	var id = dojo.query("*[id$='" + idname + "']")[0];
	if(id){
		XSP.partialRefreshGet(id.id,{
			onStart:function(){},
			onError:function(){return false;},
			onComplete:function(){}
		});
	}else{
		num = clearInterval(num);	
	}
}
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...