Atozed Forums
passing Delphi variable to javascript variable - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: passing Delphi variable to javascript variable (/thread-2488.html)



passing Delphi variable to javascript variable - Joe Sansalone - 08-15-2021

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


RE: passing Delphi variable to javascript variable - Alexandre Machado - 08-16-2021

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.