Hey Jan,
You may want to consider JSON. I don''t know much about Ruby, but JSON
is the
simplest format to use if you''re just going to be converting the
results to
JS objects anyway. Regardless of the language you use, you''ll have to
pick a
method for returning the data. There are any number of possibilities, but 3
main ones are:
1) Pure HTML
2) JSON
3) XML
Each has advantages, but 1) is good for pure HTML inserts, 2) is good when
you want to do further manipulation of the results client-side and 3) is
good if you''re planning to re-use the code for something like
web-services,
where other applications need to use the same interface.
[1] "But don''t know if I''d need JSON to do this within
Rails ?" Regardless
of language, you''ll have to eventually use JSON if you want that simple
ability of grabbing a JS object from the server. Now, whether or not Rails
can abstract that away, I''m not sure
[2] I''d check out http://en.wikipedia.org/wiki/Talk:JSON. YAML is a
serialization in Ruby that is somewhat related to JSON. Again, not being a
Ruby developer, I can''t give you the details, but also check
http://redhanded.hobix.com/inspect/yamlIsJson.html
Good luck,
Jerod
On 3/3/06, Jan Deppisch <mail-5IKmqX4pxT2zF9g5/BB5cw@public.gmane.org>
wrote:>
> Hi all,
>
> I''m building an application which uses mostly ajax to update the
> sections of the page. Now I''ve come to some thoughts on how to
make the
> ajax-handling more efficient / less buggy.
>
> Currently, when the page loads up, I start some "new
Ajax.Updater"-stuff
> to fill some sections with content from the db. I also registered
> watchers which also start nearly the same ajax-calls as on inital
> page-loading.
>
> Now I''ve come to a point where I want to reduce the ajax-calls,
because
> many of the contents is already there (in a session e.g.) or i will
> preload it. From the server-results I want to create javascript-objects
> dynamically and show them when a particular link is clicked.
>
> Are there any ressources on the web explaining on how to fill the
> content coming from ajax into javascript objects ? [1] I''m pretty
new to
> the prototype stuff. And I use Rails, so maybe there''s a cool
solution ?
> [2]
>
> Thx!
> Jan
>
> [1] Just discovered
> http://particletree.com/features/preloading-data-with-ajax-and-json/
> But don''t know if I''d need JSON to do this within
Rails ?
> [2] Concerning Rails:
> http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates
> May this be the solution ?
>
>
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs