Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

JavaScript loaded with AJAX not executed


Go to End


1343 Views

Avatar
DeklinKelly

Community Member, 197 Posts

29 July 2010 at 12:19am

This JavaScript is executed if page it is on in the admin area is the one to be loaded however it does not execute if another page in the admin is loaded first and then that page is loaded.

$fields->addFieldToTab("Root.Zooph", new LiteralField('CustomCode'.$i++,'
<script type="text/javascript">
/* <![CDATA[ */
alert('Hello World');
/* ]]> */
</script>
'));

I think the problem may be that JavaScript loaded with AJAX is not being executed.

Any ideas?