Thanks, Greg, yes the script has the script tag before: <script> for (var i = 0; i < 677; i++) { if (document.newsStoriesForm['storyIDs' + i]) { t.newsFeeds[0]["storyIDs"][i] = document.newsStoriesForm['storyIDs' + i].value; t.newsFeeds[0]["stories"][i] = document.newsStoriesForm['stories' +i].value; } } t.av('0', '677'); ultima2 = function() { var ultimaNoticia = 677; $('lastStory').innerHTML = ultimaNoticia; }; </script>
This is the complete part of the script. The response has three differents blocks of script, evalScripts search for all or just the first or last? Guillermo 2006/3/21, Gregory Hill <[EMAIL PROTECTED]>: > 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 > _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs