Slideshow transcript
Slide 1: Ajax and RJS
Slide 2: Yes, Macs Rule
Slide 3: Ajax • mini web request from javascript • used to update pieces of content in page
Slide 4: When NOT to use AJAX • when the action is related to navigation • when there is another AJAX call inside that action (will get very complicated)
Slide 5: Cons of AJAX • can slow down a page just as easy as speed up a page • explosion of partials
Slide 6: Pros of AJAX • when done well, it will make the user experience much better • saves server traffic and potentially load • and...
Slide 7: It’s cool.
Slide 8: How does it work? Something like this: You always need a library.
Slide 9: Using PrototypeJS new Ajax.Updater('my_div', '/items'); text, partial or template from server new Ajax.Request('/items') javascript from server
Slide 10: Ruby Java Script Controller: RJS template:
Slide 11: JS Generating Methods • page is the virtual page object where you can write javascript to.
Slide 12: Inline RJS • no template • in the controller
Slide 13: Rails’ Helpers
Slide 14: Using a Spinner • link_to_remote_submit already has a spinner. • put a spinner onclick, not on the callbacks • disable the spinner onComplete or on content update
Slide 15: spin_div Spinner is created in the container and gets reset when container gets updated.
Slide 16: Status Notice JS
Slide 17: Alternative and Related Techniques
Slide 18: JSON
Slide 19: Cross-Server JS
Slide 20: Comet, AJAX' big brother synchronous VS asynchronous <%= periodically_call_remote %> sucks push javascript from server, using a flash socket
Slide 21: copyleft dominiek.com



Add a comment on Slide 1
If you have a SlideShare account, login to comment; else you can comment as a guest- Favorites & Groups
Showing 1-50 of 3 (more)