Is there any way to access controller variable set in a Method in Javascript. In the example above the value is set in constructor. But when I set it in a method it is showing as NULL in Javascript
In controller:
public class abc {
public string varA { get;set; }
public void fn(){
varA='hello';
}
}
In VFPage:
function hello(){
var bool = '{!varA}';
alert(bool);
}
The alert statement in the VF Page(i.e bool) is displayed as null. Can you please help how to access a variable set from a method instead of constructor?