Hi Brian,

Awesome! That did the trick.
Thanks for the wealth of extra knowledge you've given as well.

Thanks,
-A

On Mar 22, 10:34 am, "Brian Marquis" <br...@quotepro.com> wrote:
> change your script to:
>
> <script type="text/javascript">
> window.sayHi = function() {
>         alert("Hi");}
>
> </script>
>
> Likewise, any variables defined in the script block are not evaluated in the
> global scope, therefore, they need to be assigned as properties of window or
> document. 
> Seehttp://api.prototypejs.org/language/String/prototype/evalScripts/for more
> info
>
> Brian Marquis | Quotepro® | Senior Developer | b...@quotepro.com |
> Phone: 312.654.8045 x122 / Fax: 312.654.1285
>
> The information in this e-mail is confidential and may be legally
> privileged.  It is intended solely for the addressee.   Access to this
> e-mail by anyone else is unauthorized.
>
>
>
>
>
>
>
> -----Original Message-----
> From: prototype-scriptaculous@googlegroups.com
>
> [mailto:prototype-scriptaculous@googlegroups.com] On Behalf Of Aravinda777
> Sent: Wednesday, March 21, 2012 11:11 AM
> To: Prototype & script.aculo.us
> Subject: [Proto-Scripty] JavaScript from AJAX response is not being
> available
>
> Hi all,
>
> I used Prototype to get an AJAX response fromcalling a JSP page, and set it
> as innerHTML of a div.
>
> I tried executing eval on the response separately before going with
> Prototype, and seeing that prototype evaluates javascript in the
> reponseText, I gave it a spin. However, when I try using the javascript
> functionality after setting the innerHTML, still it does not seem to have
> got evaluated.
>
> My sample JSP code looks like this:
>
> <script type="text/javascript">
> function sayHi(){
>         alert("hi");
> }
> </script>
> <p>test</p>
> <input type="button" value="click" onClick="sayHi()">
>
> I do the AJAX call like this on another page of the same app:
>
> new Ajax.Request(page, {
>                   onSuccess: function(reponse) {
>
> document.getElementById('test_div').innerHTML=reponse.responseText;
>                   }
>                 });
>
> When I click the button, I do not get the alert - which I can get if I
> accessed the JSP dierctly. Is there something additional I need to do to get
> the sayHi() function working in the target div? Or probably I am missing
> something trivial altogether.
>
> Appreciate your help on this.
>
> Regards,
> -A
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-scriptaculous@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to