Guys, I posted this in the Rails group, but then I found this one which is more appropriate. I am having problems getting some of my javascript to run in Safari 2.04 on OS X. It works fine in Firefox 2.0 on the mac, but in Safari it doesn''t run at all, as Safari is complaining about the syntax. I stripped the code right down to the following: function makeRequest() { url = ''/ajaxtest/index''; new Ajax.Request(url, { method: ''get'', onSuccess: function success(t) { // -----> Safari gives a syntax error on this line (Syntax error - parse error) alert(''success''); }, onFailure: function failure(t) { alert(''failed ajax''); } } ); } As far as I can tell this example is identical to the example in the prototype.js api docs - I just cannot figure out what is wrong! Any ideas would help a lot! Thanks, Stephen. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On 11/10/2007, stephen O''D <stephen.odonnell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Guys, > > I posted this in the Rails group, but then I found this one which is > more appropriate. I am having problems getting some of my javascript > to run in Safari 2.04 on OS X. It works fine in Firefox 2.0 on the > mac, but in Safari it doesn''t run at all, as Safari is complaining > about the syntax. > > I stripped the code right down to the following: > > function makeRequest() { > url = ''/ajaxtest/index''; > new Ajax.Request(url, { > method: ''get'', > onSuccess: function success(t) { // -----> Safari gives a syntax > error on this line (Syntax error - parse error) > alert(''success''); > }, > onFailure: function failure(t) { > alert(''failed ajax''); > } > } ); > > } > > As far as I can tell this example is identical to the example in the > prototype.js api docs - I just cannot figure out what is wrong! Any > ideas would help a lot! > > Thanks, > > Stephen.Functions used in this way are anonymous - they don''t need a name. Try this ... function makeRequest() { url = ''/ajaxtest/index''; new Ajax.Request(url, { method: ''get'', onSuccess: function(t) { alert(''success''); }, onFailure: function failure(t) { alert(''failed ajax''); } } ); } You''ll see the example at http://prototypejs.org/api/ajax/request does NOT have a name for the function. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On 11/10/2007, stephen O''D <stephen.odonnell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Guys, > > I posted this in the Rails group, but then I found this one which is > more appropriate. I am having problems getting some of my javascript > to run in Safari 2.04 on OS X. It works fine in Firefox 2.0 on the > mac, but in Safari it doesn''t run at all, as Safari is complaining > about the syntax. > > I stripped the code right down to the following: > > function makeRequest() { > url = ''/ajaxtest/index'';Functions used in this way are anonymous - they don''t need a name. Try this ... function makeRequest() { url = ''/ajaxtest/index''; new Ajax.Request(url, { method: ''get'', onSuccess: function(t) { alert(''success''); }, onFailure: function(t) { alert(''failed ajax''); } } ); } Sorry for the double post. Didn''t see that you made the same mistake twice. Richard -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Ah of course! I won''t have access to OS X until this evening (my day job forces windows upon me ... ) but I will test it out then and let you know. Thanks, Stephen. On Oct 11, 10:28 am, "Richard Quadling" <rquadl...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 11/10/2007, stephen O''D <stephen.odonn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Guys, > > > I posted this in the Rails group, but then I found this one which is > > more appropriate. I am having problems getting some of my javascript > > to run in Safari 2.04 on OS X. It works fine in Firefox 2.0 on the > > mac, but in Safari it doesn''t run at all, as Safari is complaining > > about the syntax. > > > I stripped the code right down to the following: > > > function makeRequest() { > > url = ''/ajaxtest/index''; > > Functions used in this way are anonymous - they don''t need a name. > > Try this ... > > function makeRequest() { > url = ''/ajaxtest/index''; > new Ajax.Request(url, { > method: ''get'', > onSuccess: function(t) { > alert(''success''); > }, > onFailure: function(t) { > alert(''failed ajax''); > } > } ); > > } > > Sorry for the double post. Didn''t see that you made the same mistake twice. > > Richard > > -- > ----- > Richard Quadling > Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731 > "Standing on the shoulders of some very clever giants!"--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---