i created a script tag in visualforce
<apex:page controller="ActionFunctionDemoController">
<apex:form >
<apex:actionFunction name="action1" action="{!action1}" rerender="scriptPanel" />
<apex:outputPanel id="scriptPanel">
<script>
var xy="{!xy}";
console.log(xy);
setInterval(function(){
console.log(xy);
},5000);
action1();
</script>
</apex:outputPanel>
</apex:form>
</apex:page>
and there is an apex class
public with sharing class ActionFunctionDemoController {
public String xy{get;set;}
public ActionFunctionDemoController(){
xy='Hello';
}
public Pagereference action1(){
xy='Hello Hello';
return null;
}
}
in console every time its give 'Hello' not 'Hello Hello' means script tag is not rerendered.Please guideline how to rerender script tag ??
Best Answer
I test and it works.I am not sure is it return the output that you want.I move the panel to outside of the apex:form.