How Do You Refresh a Menu (or the Heading of a Menu App)?

I have a menu app which displays contents of a global variable, say [var] in Heading Line 1 (Layout).

On of the apps the menu points to allows the user select from a drop-down. That drop-down changes the contents of [var].

I want Heading Line 1 to change whenever a new value is selected from the drop down (i.e. display the new value of [var]).

I have tried putting this as the last statement in onValidateSuccess event of the switching app:

sc_redir(“menu_global”,"","_parent");

This works great, the heading changes without a flicker. But once I do a switch, “Logout” in the menu bar (which points to “Leave” as Target) no longer works correctly. It returns me to the switching app selector. If I logout in a session without visiting the switching app, it works correctly.

Is there a better way to achieve my objective?

Hi, ScriptCaser,
You can update a menu item using scriptcase.

Option A: Using sc_appmenu_update_item macro.
Option B: Using javascript to change your item label v?a ajax.


<script>

function update(){
	$.post('../ajax/ajax.php', '',  //Ajax file that returns your new menu item label
		function(data){
			$('#menu_item').html(data); // change your #menu_item with your menu item ID
	    });
    return false;	
} 

$(document).ready(function() {
	setInterval(update, 10000);  // Runs every 10 seconds
	update(); // calls the update function
});

</script>