Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ExecuteJS and CallbackResponse.AddJavaScriptToExecute
#1
Is there any difference between ExecuteJS() and CallbackResponse.AddJavaScriptToExecute()?
Reply
#2
ExecuteJS() calls AddJavaScriptToExecuteAsCDATA() internally *when* it is a callback response (async). If the code is being executed from a sync event, it will call AddToInitProc() which also executes the JS code, but when the page loads.

So, in general it is safe to replace CallbackResponse.AddJavaScriptToExecute() by ExecuteJS() (which is waaaay shorter) with the advantage that it will also work during a sync event.
Reply
#3
(01-28-2024, 06:02 AM)Alexandre Machado Wrote: ExecuteJS() calls AddJavaScriptToExecuteAsCDATA() internally *when* it is a callback response (async). If the code is being executed from a sync event, it will call AddToInitProc() which also executes the JS code, but when the page loads.

So, in general it is safe to replace CallbackResponse.AddJavaScriptToExecute() by ExecuteJS() (which is waaaay shorter) with the advantage that it will also work during a sync event.

Okay, thanks alex
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)