Does your response have <script> tags around the script?  evalScripts
looks for that and runs any code inside <script> tags.  It doesn't just
blindly eval the whole block. You should be able to also have html
markup in the response. 

Greg

> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:rails-spinoffs-
> [EMAIL PROTECTED] On Behalf Of Guillermo Movia
> Sent: Tuesday, March 21, 2006 2:34 PM
> To: rails-spinoffs@lists.rubyonrails.org
> Subject: Re: [Rails-spinoffs] Javascript Code inside an Ajax response
> 
> Thanks for the answers, but It isn't work yet. This is the code in the
> ajax response. Before this, the response has a code for an html table
> (i don't know if i could mix javascript code and html)
> 
> ultima2 = function() {
> var ultimaNoticia = 677;
> $('lastStory').innerHTML = ultimaNoticia;
> };
> </script>
> <input type=button value='Apretar' onclick='ultima2()' />
> 
> Now, my ajax call says:
> 
> var consultaAjax = new Ajax.Updater (
>       'tabla',
>       url,
>       {
>               method: 'get',
>               parameters: pars,
>               evalScripts: true
>       });
> }
> 
> But when i press the button, it said ultima2 is not declared. Which
> thing i am making bad.
> Thanks
> 
> Guillermo
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to