How to trigger script in a stateless form via API call from external site?

How to trigger script in a stateless form via API call from external site?

Is this possible? In my tests so far the API call itself is successful but the code in the "on click" action does not run. Is there a trick to getting the script to execute via the API call?