Rahul Bhargava
2005-Aug-23 15:28 UTC
[Rails-spinoffs] using the evalScript option on Ajax.Updater
Hi all, I''m having trouble with the evalScript option on the Ajax.Updater. I''ve removed everything except for the ajax call and a simple alert to try and debug it. It doesn''t appear that the regex is finding my JS in the response... I''m doing an update request and the response is coming back correctly to the updateConent function as this string: <script language="Javascript"> alert("fdsfa"); </script> But the scripts var inside of updateContent is still coming out as null. Thus, obviously, my alert isn''t being run, because it doesn''t think it''s a script. My regex is a little rusty, so I''m not quite sure what the ":" does in the ScriptFragment variable it''s using to parse out JS code to then eval. Any tips? Thanks much! Rahul
Dillon Woods
2005-Aug-23 16:34 UTC
[Rails-spinoffs] using the evalScript option on Ajax.Updater
On 8/23/05, Rahul Bhargava <rahul@ntag.com> wrote:> I''m having trouble with the evalScript option on the Ajax.Updater. I''ve > removed everything except for the ajax call and a simple alert to try > and debug it. It doesn''t appear that the regex is finding my JS in the > response...How exactly are you making the Ajax.Updater call? Did you mean evalScripts instead of evalScript? If you left the ''s'' off the end in your code, then that is probably the problem. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails-spinoffs/attachments/20050823/e4e54ded/attachment.html
Rahul Bhargava
2005-Aug-23 16:43 UTC
[Rails-spinoffs] using the evalScript option on Ajax.Updater
Haha, no, I do have the key name spelled correctly, thanks though :-) I changed my JS that is returned by the server to be all on one line and it worked. Very strange, as I thought one of the "img" options on the regex was there to make line breaks not matter. I''m in the latest firefox. Anyone else had that problem? On a related matter - I actually want a slightly different behaviour. If the form submit is ok (as decided by the server), then I want it to do as normally and update the content with what I send back. If my biz logic finds errors in the form submit, I just want to run some javascript (that flags certain fields), and NOT replace the content. That''s a different enough behaviour that I''m going to write up my own subclass to try and do that tomorrow. I didn''t see any easy way to hack that with the existing version. Anybody got a tip? Thanks, rahul ________________________________ From: rails-spinoffs-bounces@lists.rubyonrails.org [mailto:rails-spinoffs-bounces@lists.rubyonrails.org] On Behalf Of Dillon Woods Sent: Tuesday, August 23, 2005 5:44 PM To: Ruby Spinoffs List Subject: Re: [Rails-spinoffs] using the evalScript option on Ajax.Updater On 8/23/05, Rahul Bhargava <rahul@ntag.com> wrote: I''m having trouble with the evalScript option on the Ajax.Updater. I''ve removed everything except for the ajax call and a simple alert to try and debug it. It doesn''t appear that the regex is finding my JS in the response... How exactly are you making the Ajax.Updater call? Did you mean evalScripts instead of evalScript? If you left the ''s'' off the end in your code, then that is probably the problem. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails-spinoffs/attachments/20050823/9d252bd3/attachment-0001.html