2

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?

3
  • Depends. Does exitWithErrorPage work? Is do_something() defined before calling? Commented Jul 22, 2014 at 23:04
  • >Does exitWithErrorPage work? Yes, it works. 'do_something()' defined, sure Commented Jul 22, 2014 at 23:06
  • 2
    you have a double quote in script tag - <script">, maybe that's the problem? Commented Jul 22, 2014 at 23:15

1 Answer 1

2

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>');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.