If I have a file in view /test called index.js.erb and in it a simple alert("hello") shouldn''t that run when I go to /test/index? It doesn''t. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/25cb5ad9a7367a51c4821cadd1554cef%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On 31 May 2013 18:36, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> If I have a file in view /test called index.js.erb and in it a simple > alert("hello") shouldn''t that run when I go to /test/index? It doesn''t.I think you will have to give us a bit more detail on exactly what you have done. First have a look at the Rails Guide on Debugging to see ways that you can debug your code to work out what is going wrong. Colin> > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/25cb5ad9a7367a51c4821cadd1554cef%40ruby-forum.com?hl=en-US. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuSMYKfVk6uDPpPBRvPfpPmxGu9jYcKQCxipXmkEGDF1w%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law wrote in post #1110840:> On 31 May 2013 18:36, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> If I have a file in view /test called index.js.erb and in it a simple >> alert("hello") shouldn''t that run when I go to /test/index? It doesn''t. > > I think you will have to give us a bit more detail on exactly what you > have done. First have a look at the Rails Guide on Debugging to see > ways that you can debug your code to work out what is going wrong. > > ColinNot sure how I can explain it better. It''s a very simple example. When going with the browser to an action with a corresponding *.js.erb file should the JavaScript in that file run, like alert("hello")? Or is that old rjs? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/568554ed7e6ad48e48afe08142abf96d%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On 1 June 2013 09:00, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #1110840: >> On 31 May 2013 18:36, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> If I have a file in view /test called index.js.erb and in it a simple >>> alert("hello") shouldn''t that run when I go to /test/index? It doesn''t. >> >> I think you will have to give us a bit more detail on exactly what you >> have done. First have a look at the Rails Guide on Debugging to see >> ways that you can debug your code to work out what is going wrong. >> >> Colin > > Not sure how I can explain it better. It''s a very simple example. > > When going with the browser to an action with a corresponding *.js.erb > file should the JavaScript in that file run, like alert("hello")? Or is > that old rjs?Look in development.log to see what is happening. Look at the source in the browser to see what is being sent to the browser. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLukZ6Xk3gVNrVBzoGSzEtmgdw3ACmHiJB6cuNba7_UySw%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law wrote in post #1110879:> On 1 June 2013 09:00, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >> Not sure how I can explain it better. It''s a very simple example. >> >> When going with the browser to an action with a corresponding *.js.erb >> file should the JavaScript in that file run, like alert("hello")? Or is >> that old rjs? > > Look in development.log to see what is happening. Look at the source > in the browser to see what is being sent to the browser. > > ColinDoesn''t seem to load. This should be so incredible simple. Why doesn''t it work? What have I missed? Should this very very basic example of UJS work? Do I need to add something with format.js {}? In routes? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a2c95ed366bac8f9391bc4ba7e99b687%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Have you a route to a corresponding controller in general? Have you a controller? Does this controller work when you try to deliver an HTML view? Oh, and when you want to have a js response, then you must use /test/index.js, without the extension given rails will try to deliver HTML (if you haven''t configured it to do something else). Do you get an error message in server logs or browser when you try to access your ressource? Which one? Answer this questions as exactly as possible or we can''t help. Am 01.06.2013 11:52 schrieb "Paul Bergstrom" <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Colin Law wrote in post #1110879: > > On 1 June 2013 09:00, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> > >> Not sure how I can explain it better. It''s a very simple example. > >> > >> When going with the browser to an action with a corresponding *.js.erb > >> file should the JavaScript in that file run, like alert("hello")? Or is > >> that old rjs? > > > > Look in development.log to see what is happening. Look at the source > > in the browser to see what is being sent to the browser. > > > > Colin > > Doesn''t seem to load. This should be so incredible simple. Why doesn''t > it work? What have I missed? > > Should this very very basic example of UJS work? Do I need to add > something with format.js {}? In routes? > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/a2c95ed366bac8f9391bc4ba7e99b687%40ruby-forum.com?hl=en-US > . > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2BbCVss%2BEQ8Kb-Pn9QjHXf8H9LBzvfT2U36J9G9OdMtu-F6tmA%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On 1 June 2013 10:52, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #1110879: >> On 1 June 2013 09:00, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> >>> Not sure how I can explain it better. It''s a very simple example. >>> >>> When going with the browser to an action with a corresponding *.js.erb >>> file should the JavaScript in that file run, like alert("hello")? Or is >>> that old rjs? >> >> Look in development.log to see what is happening. Look at the source >> in the browser to see what is being sent to the browser. >> >> Colin > > Doesn''t seem to load. This should be so incredible simple. Why doesn''t > it work? What have I missed?No idea what you mean by "doesn''t seem to load". What do you see in the log file? It is very difficult to help if you won''t give us any information. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLudZ-NbBmM03jbqsXg6iUggWCigCd6KGSp96Xb%3D6DXi9Q%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Norbert Melzer wrote in post #1110888:> Have you a route to a corresponding controller in general? Have you a > controller? Does this controller work when you try to deliver an HTML > view?Yes.> Oh, and when you want to have a js response, then you must use > /test/index.js, without the extension given rails will try to deliver > HTMLI know. You mean index.js.erb?> (if you haven''t configured it to do something else). Do you get an error > message in server logs or browser when you try to access your ressource? > Which one?No error messages.> > Answer this questions as exactly as possible or we can''t help.Thank you for your help. Should this basic example work, onload? Or should I skip extra js-files?> Am 01.06.2013 11:52 schrieb "Paul Bergstrom" <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/63a65394b5dda4a8c29eef2202e4c8d6%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law wrote in post #1110893:> On 1 June 2013 10:52, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> in the browser to see what is being sent to the browser. >>> >>> Colin >> >> Doesn''t seem to load. This should be so incredible simple. Why doesn''t >> it work? What have I missed? > > No idea what you mean by "doesn''t seem to load". What do you see in > the log file? It is very difficult to help if you won''t give us any > information. > > ColinYou don''t need more information. Thanks for your help but don''t look for something I didn''t ask. :-) The log file seems to be ok. Not sure what to look for. No error messages when loading the file. That''s all I can say. I think it''s better if you could verify that this normally should work. That was my intention when asking the question. It would be a great help. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4d56296fbe01e0b4ba7c4ebb95bfe87c%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On 1 June 2013 11:52, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #1110893: >> On 1 June 2013 10:52, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>>> in the browser to see what is being sent to the browser. >>>> >>>> Colin >>> >>> Doesn''t seem to load. This should be so incredible simple. Why doesn''t >>> it work? What have I missed? >> >> No idea what you mean by "doesn''t seem to load". What do you see in >> the log file? It is very difficult to help if you won''t give us any >> information. >> >> Colin > > You don''t need more information. Thanks for your help but don''t look for > something I didn''t ask. :-) > > The log file seems to be ok. Not sure what to look for. No error > messages when loading the file. That''s all I can say.Just show us the log please. That will enable us to check that what you think is happening is happening. Colin> > I think it''s better if you could verify that this normally should work. > That was my intention when asking the question. It would be a great > help. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4d56296fbe01e0b4ba7c4ebb95bfe87c%40ruby-forum.com?hl=en-US. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsq0hiyNqUgWDR5CZt%3DD9nLXKD1H37p28xgNEEy_TNr8g%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Norbert Melzer
2013-Jun-01 12:23 UTC
Re: Re: Re: Re: A simple javascript alert not working
2013/6/1 Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> Norbert Melzer wrote in post #1110888: > > Oh, and when you want to have a js response, then you must use > > /test/index.js, without the extension given rails will try to deliver > > HTML > > I know. You mean index.js.erb?I mean, if your js-file is /app/views/test/index.js.erb AND your controller is /app/controllers/test_controller.rb AND you have route setup to the index action, then you have to point your browser to " http://localhost:3000/test/index.js". This way you should see the content of your index.js.erb. If you can''t see it, there is something going wrong. And if there is something going wrong you need to provide that pieces of further information that is Colin asking you since the start of the thread. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2BbCVsuUuSYpy03XzZgZhy3PVkvO-oveTaJCaPA6H79YdYhdbA%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Paul Bergstrom
2013-Jun-01 14:15 UTC
Re: Re: Re: Re: A simple javascript alert not working
Norbert Melzer wrote in post #1110905:> 2013/6/1 Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> I mean, if your js-file is /app/views/test/index.js.erb AND your > controller > is /app/controllers/test_controller.rb AND you have route setup to the > index action, then you have to point your browser to " > http://localhost:3000/test/index.js". This way you should see the > content > of your index.js.erb. If you can''t see it, there is something going > wrong. > > And if there is something going wrong you need to provide that pieces of > further information that is Colin asking you since the start of the > thread.I think I understand it better now. My example will only work if it''s an ajax call, specifically pointing to a js script? Is that right. So that would mean a NO to my question. An alert(hello"") will not run, in a file "index.js.erb", by simply going to the corresponding action "index", the HTML file? No need for log file. :-) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/84e76e408b29d121a41a8329dc2a2685%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.