On Dec 20, 4:27 pm, Ken Wagner <[email protected]> wrote: > > Also, using javascript: pseudo-URLs in the href field is generally a > > in the href field is generally a > > bad idea (and note the lowercase j!). Using onclick as in my original > > example is much better. > > >> I am using NB 6.5 for Ruby/Rails. > > > Irrelevant unless that's what you're using as a Web browser as well as > > an IDE. Is that the case? > > Marnen: > > I have used WebBrick and Mongrel at the command prompt. > > Currently I have NetBeans 6.5 set to use Mongrel within NB, it seems to > work the same, just no command window.
Again, irrelevant. I was asking about your Web *browser* (you know, Safari, Firefox, Internet Exploder, whatever), since that's where JavaScript runs. WEBrick (not "WebBrick") and Mongrel are Web *servers*: although they run the Ruby side of your application, they have nothing to do with how your JavaScript is being interpreted. > > I will investigate using your onclick suggestion. Good. Even better would be to have the onClick handler set from an external JavaScript file (see http://en.wikipedia.org/wiki/Unobtrusive_JavaScript ), but that's slightly harder to set up, so you may not want to worry about it initially. > > There's a handicap, though. I am totally new to javascript JavaScript, > JScript JQuery, Rails prototype.js (I think it's a variant form of > javascript), Ajax and JSON. > > Pretty clueless about it. Yes, I can see that. :) (I don't mean that as an insult -- merely a recognition that you do have a lot to learn here, and I'll help if I can.) Let's start by untangling the terminology. * JavaScript is the programming language itself. * javascript: is the pseudoprotocol specifier used to make JavaScript calls conform to URL syntax (as in the href="javascript:history.go (-1)" syntax I encouraged you to avoid). * JScript is basically Microsoft's JavaScript implementation. * Prototype.js is *not* a variant form of JavaScript. Rather, it is a library of useful JavaScript functions meant to make JavaScript programming easier. See http://www.prototypejs.org/ . jQuery is likewise a library, similar to Prototype. * Ajax is a term for a style of Web application programming that uses JavaScript (rather than loading new pages) to communicate with the server. * JSON is a data interchange format that is derived from, but independent of, JavaScript. See http://json.org . > I found a wonderful javascript tutorial at the > www3 (world wide web online 'school') I am going to start learning > there. Do you mean the W3C or w3schools.com ? They both contain many useful resources, but they're two different entities. Also, if you are trying to learn JavaScript, I would *highly* recommend David Flanagan's "JavaScript: The Definitive Guide", published by O'Reilly -- I have seen reviews that say that it's the *only* JS book that actually teaches proper programming practices, and my experience with other JS books would confirm that assessment. > > In general it appears that HTML is one layer, the HTTP / Server > communication protocol another, Rails 'ERB' yet another, the browser > itself is also a layer and that javascript is an inter-layer link > between the browser and the underlying HTML/generator/embedded logic > generator tools. I think you're complicating things a bit too much. Basically, the server runs your application (which, in Rails, may include Ruby code, either standing on its own or inserted into HTML files by means of ERb or Haml templates). The browser (client) communicates with the server using HTTP. JavaScript is not an "inter-layer link", but simply helps the browser present a better user interface. JavaScript exists *only* on the client side -- that is, in the browser. Ruby (including ERb) only exists on the server side. The only link between the client side and server side is the use of HTTP to exchange information. Is that clearer? [Note: There *are* environments that use server-side JavaScript, but Rails isn't one of them, so the description I gave above, while slightly oversimplified, is accurate for what you'll be doing.] > > Obviously, there are different flavors of browser-to-embedded logic > javascript tools. What do you mean by that? > > So, I plan to do javascipt, Rails prototype.js, AJAX, JSON in that > order. Yes, learn basic JavaScript and the Protoype library (or jQuery, or MooTools, or YUI, or whatever JavaScript library you'll be using). Get familar with JSON (and YAML) as part of that process. Learn Rails and build conventional Web applications with it. *Then* -- only after you've built conventional Web applications -- learn Ajax. Or at least that's my recommendation. > > Many thanks, > > Ken Good luck! Let me know if you have further questions. Best, -- Marnen Laibow-Koser [email protected] http://www.marnen.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

