Hello Everybody, i need to run a javascript method after the ajax refresh of a chart. I'm trying to do that using runJavascript in the preparation of my page and i can't use javascript or actions inside button click actions or anything, because in this screen exists a lot of blocks with charts, and i'm trying to do changes with her elements only in one local, like i do for other things. The case is, when i click a button, a chart starts to refresh its content (changing values by quantity rather than price), but i need to execute a javascript only after the end of this refresh. I already tried to run a recursive code that checks if the body has the class of Feedback_AjaxWait (but the code didn't get the class because the ajax refresh appear and disappear very quickly), tried to check attributes of a div (div of ajax wait) to see when the ajax starts and stop... tried to delay the check, tried to click buttons twice time to increase the time refresh stays on screen... but nothing solved my problem. I tried to use document.addEventListener('DOMContentLoaded') too, but nothing... Can someone help me please?


I find the solution using 

SyntaxEditor Code Snippet





Hi Pedro,

I'm pretty sure that will bind to all Ajax requests... not sure that's what you will want. Also, that is an undocumented/unsupported feature so you should use it with care, it may break in the future.

Another alternative, probably better suited for your specific case, is to put your chart in a named container, and add to the container (and after the chart) an Expression with Escape Content set to No, where you place a <script> tag with the javascript you want to run. If you refresh the container instead of the chart, the browser will execute your javascript after parsing and executing whatever the chart requires.

Hope this helps