Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change global variable in Javascript
#1
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";');
Reply
#2
Hi Matija, try:
Code:
WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA( 'var link="c:\temp\test2.pdf";' );
Reply
#3
(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)
Reply
#4
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)