0

I am using dijit/Dialog module of dojo. Ajax popup is working fine but when I include any javascript in that popup that is not working please have a look on below code.

<script src="<?php echo $this->basePath()?>/js/dojo_lib/dojo/dojo.js" data-dojo-config="isDebug:1, async:1"></script>
<script>
    require(["dijit/Dialog"]);
</script>
<a title="Create a New Account" class="registration" href="javascript:void(0);" onclick="dijit.byId('user_registration').show();">Registration</a>
<div class="dijitHidden">
    <!-- dialog that gets its content via ajax, uses loading message -->
    <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Register',href:'/account/register',loadingMessage:'Loading form...'" id="user_registration"></div>
</div>

Above code is used to show popup.

popup page is something like this

<div>
Register
</div>
<script>
alert('Hello');
</script>

this alert is not working in that popup. Please help

2 Answers 2

2

tik27 has probably the best general answer (and it explains why it doesn't work out of the box).

If you don't want to do the evaluating by yourself, Dojo also has a module/widget called dojox/widget/DialogSimple (and dojox/widget/Dialog) and it has a property executeScripts. If you enable it, it will evaluate all scripts on that page.

So if you don't want to do the script evaluation yourself, try using this widget.

Sign up to request clarification or add additional context in comments.

Comments

1

Take a look at. Calling a JavaScript function returned from an Ajax response

It deals with javascript received from an ajax call, since this is what is happening in the background.

1 Comment

Thank you, you are right this is the problem, Dimitri M gave solution Dojo way :)

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.