Hi there, Im really struggling to get prototype to work. I have my prototype javascript files in the page like so: <script src="scripts/scriptaculous-1.6.1/prototype.js" type="text/ javascript" /> <script src="scripts/scriptaculous-1.6.1/scriptaculous.js" type="text/ javascript" /> And then a third file, my own javascript file with a prototype Ajax.Request call in it: <script src="scripts/ajaxStuff.js" type="text/javascript" /> Which contains: function test(){ new Ajax.Request("servletName", { asynchronous: true, method: "get", onSuccess: function(request) { alert("a message!"); } }); } I attempt to call this function, using the onclick event of a button: <button name="button" onclick="test()"></button> The problem is, whenever i click this button, I get a JavaScript error, saying ''Object Expected'' I have tried everything and am about ready to give up. Does anyone have any idea as to why this wouldnt be working? Many thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
thorasmund-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Mar-13 06:17 UTC
Re: Cannot Get Prototype to work
Your example works fine here May I advise that you check your paths? Maybe something is wrong there. cheers, On Mar 13, 2:23 pm, AddictedToCoffee <kristophe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi there, > > Im really struggling to get prototype to work. > > I have my prototype javascript files in the page like so: > > <script src="scripts/scriptaculous-1.6.1/prototype.js" type="text/ > javascript" /> > <script src="scripts/scriptaculous-1.6.1/scriptaculous.js" type="text/ > javascript" /> > > And then a third file, my own javascript file with a prototype > Ajax.Request call in it: > > <script src="scripts/ajaxStuff.js" type="text/javascript" /> > > Which contains: > > function test(){ > new Ajax.Request("servletName", { > asynchronous: true, > method: "get", > onSuccess: function(request) { > alert("a message!"); > } > }); > > } > > I attempt to call this function, using the onclick event of a button: > > <button name="button" onclick="test()"></button> > > The problem is, whenever i click this button, I get a JavaScript > error, saying ''Object Expected'' > > I have tried everything and am about ready to give up. Does anyone > have any idea as to why this wouldnt be working? > > Many thanks!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Paths are OK. it would appear. If I remove the Ajax.Request code from the method, and just leave an alert in there purely to test, I still get the object expected message, which leads me to think its on the prototype stuff, but the actual JavaScript thats the problem. Were you able to get my above example working then? Cheers On Mar 13, 6:17 am, "thorasm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <thorasm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Your example works fine here > May I advise that you check your paths? Maybe something is wrong > there. > > cheers, > > On Mar 13, 2:23 pm, AddictedToCoffee <kristophe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi there, > > > Im really struggling to get prototype to work. > > > I have my prototype javascript files in the page like so: > > > <script src="scripts/scriptaculous-1.6.1/prototype.js" type="text/ > > javascript" /> > > <script src="scripts/scriptaculous-1.6.1/scriptaculous.js" type="text/ > > javascript" /> > > > And then a third file, my own javascript file with a prototype > > Ajax.Request call in it: > > > <script src="scripts/ajaxStuff.js" type="text/javascript" /> > > > Which contains: > > > function test(){ > > new Ajax.Request("servletName", { > > asynchronous: true, > > method: "get", > > onSuccess: function(request) { > > alert("a message!"); > > } > > }); > > > } > > > I attempt to call this function, using the onclick event of a button: > > > <button name="button" onclick="test()"></button> > > > The problem is, whenever i click this button, I get a JavaScript > > error, saying ''Object Expected'' > > > I have tried everything and am about ready to give up. Does anyone > > have any idea as to why this wouldnt be working? > > > Many thanks!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Try using full </script> closing tags... One of the browsers silently fails when you use the short tags on <script .... /> jeremy On Mar 13, 2:57 am, AddictedToCoffee <kristophe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Paths are OK. it would appear. > > If I remove the Ajax.Request code from the method, and just leave an > alert in there purely to test, I still get the object expected > message, which leads me to think its on the prototype stuff, but the > actual JavaScript thats the problem. > > Were you able to get my above example working then? > > Cheers > > On Mar 13, 6:17 am, "thorasm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <thorasm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > Your example works fine here > > May I advise that you check your paths? Maybe something is wrong > > there. > > > cheers, > > > On Mar 13, 2:23 pm, AddictedToCoffee <kristophe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi there, > > > > Im really struggling to get prototype to work. > > > > I have my prototype javascript files in the page like so: > > > > <script src="scripts/scriptaculous-1.6.1/prototype.js" type="text/ > > > javascript" /> > > > <script src="scripts/scriptaculous-1.6.1/scriptaculous.js" type="text/ > > > javascript" /> > > > > And then a third file, my own javascript file with a prototype > > > Ajax.Request call in it: > > > > <script src="scripts/ajaxStuff.js" type="text/javascript" /> > > > > Which contains: > > > > function test(){ > > > new Ajax.Request("servletName", { > > > asynchronous: true, > > > method: "get", > > > onSuccess: function(request) { > > > alert("a message!"); > > > } > > > }); > > > > } > > > > I attempt to call this function, using the onclick event of a button: > > > > <button name="button" onclick="test()"></button> > > > > The problem is, whenever i click this button, I get a JavaScript > > > error, saying ''Object Expected'' > > > > I have tried everything and am about ready to give up. Does anyone > > > have any idea as to why this wouldnt be working? > > > > Many thanks!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
thorasmund-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Mar-13 23:34 UTC
Re: Cannot Get Prototype to work
In the version of Scriptaculous that I use (1.8.1) the scriptaculous.js is in a subfolder called "src" under the "scriptaculous-js-1.8.1" path, and "prototype.js" is under a subfolder called "lib". But maybe the structure was different in version 1.6.1? Have you tried downloading the latest Scriptaculous? On Mar 13, 11:58 pm, jwmeigs <tippingpi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try using full </script> closing tags... One of the browsers silently > fails when you use the short tags on <script .... /> > > jeremy > > On Mar 13, 2:57 am, AddictedToCoffee <kristophe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Paths are OK. it would appear. > > > If I remove the Ajax.Request code from the method, and just leave an > > alert in there purely to test, I still get the object expected > > message, which leads me to think its on the prototype stuff, but the > > actual JavaScript thats the problem. > > > Were you able to get my above example working then? > > > Cheers > > > On Mar 13, 6:17 am, "thorasm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <thorasm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > Your example works fine here > > > May I advise that you check your paths? Maybe something is wrong > > > there. > > > > cheers, > > > > On Mar 13, 2:23 pm, AddictedToCoffee <kristophe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi there, > > > > > Im really struggling to get prototype to work. > > > > > I have my prototype javascript files in the page like so: > > > > > <script src="scripts/scriptaculous-1.6.1/prototype.js" type="text/ > > > > javascript" /> > > > > <script src="scripts/scriptaculous-1.6.1/scriptaculous.js" type="text/ > > > > javascript" /> > > > > > And then a third file, my own javascript file with a prototype > > > > Ajax.Request call in it: > > > > > <script src="scripts/ajaxStuff.js" type="text/javascript" /> > > > > > Which contains: > > > > > function test(){ > > > > new Ajax.Request("servletName", { > > > > asynchronous: true, > > > > method: "get", > > > > onSuccess: function(request) { > > > > alert("a message!"); > > > > } > > > > }); > > > > > } > > > > > I attempt to call this function, using the onclick event of a button: > > > > > <button name="button" onclick="test()"></button> > > > > > The problem is, whenever i click this button, I get a JavaScript > > > > error, saying ''Object Expected'' > > > > > I have tried everything and am about ready to give up. Does anyone > > > > have any idea as to why this wouldnt be working? > > > > > Many thanks!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---