AnsweredAssumed Answered

JSON error during after_ui_frame hook in email module. v6.5

Question asked by Rodolfo Tuble on Aug 5, 2016

I am executing a script inside my after_ui_frame hook for the email module. Since I want this script to be executed after the page is loaded. As I do now know how to add a new javascript inside the email module.

 

This is my function:

 

function after_ui_frame_method($event, $arguments)
{
echo '<script>
alert("test");
</script>';
}

 

Error I get: VM123572:1 Uncaught SyntaxError: Unexpected token < in JSON at position 147

 

Reason:

 

{"tree_data":{"nodes":[{"text":"Home","id":"Home","dynamicload":true,"dynamicloadfunction":"","expanded":true,"children":[],"type":1}]},"param":[]}<script>
alert("test");
</script>

 

The script that I echoed inside the hook is appended to a JSON, which then causes this problem.

Outcomes