Atozed Forums

Full Version: Change global variable in Javascript
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have in my HTML template javascript global variable. How change this value?

var link="c:\temp\test1.pdf"; -> var link="c:\temp\test2.pdf"; 

Not work this: WebApplication.CallBackResponse.AddJavaScriptToExecute('link="c:\temp\test2.pdf";');
Hi Matija, try:
Code:
WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA( 'var link="c:\temp\test2.pdf";' );
(07-19-2019, 10:18 AM)Jose Nilton Pace Wrote: [ -> ]Hi Matija, try:
Code:
WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA( 'var link="c:\temp\test2.pdf";' );

How change JS variable define in mastertemplate.html for all forms? Value for language link (JSON -> datatables)
We need an example. If the variable is already declared in the browser page context, you can just update the value of the variable, example:


Code:
WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA( 'link="c:\temp\test2.pdf";' );


This will update a variable named "link" declared previously somehwere in your page. Any javascript code that makes use of this link variable will get the updated content