passing Delphi variable to javascript variable

<< Click to Display Table of Contents >>

Navigation:  Forum >

passing Delphi variable to javascript variable

Forum link

 


 

08-15-2021, 02:28 PM:

 

Hi,

 

Is there a way to pass Delphi var to a javascript variable?

 

I know that I can call WebApplication.CallBackResponse.AddJavaScriptToExecute 

 

to execute a javascript function and pass it the actual string (i.e. value of the variable).

 

But if I don't want to expose the contents of the delphi variable in html/javascript, 

 

how do I pass it?

 

Thanks,

 

Joe

 


 

08-16-2021, 09:23 PM:

 

I need a little more context. You can just declare a variable in Javascript using AddJavaScriptToExecute(), and then use it anywhere.

 

Like: WebApplication.CallbackResponse.AddJavaScriptToExecute('var myvariable = "abcd"');

 

and it will be available while this page is active.