I have php code
exitWithErrorPage(_gettext('error#1').'<script">do_something()</script>');
When error come out, javascript function 'do_something()' should work, but it's didn't. Is it possible?
From what I see this should work correctly, as expected. The only wrong thing is the double quote in your script tag. Assuming this is how you were running it, it may be interpreted as a closing double quote for another html tag and throw an error in the browser.
Try like this, see if it will work.
exitWithErrorPage(_gettext('error#1').'<script>do_something()</script>');
exitWithErrorPagework? Isdo_something()defined before calling?exitWithErrorPagework? Yes, it works. 'do_something()' defined, sure