On Monday 22 January 2007 00:57, anathema wrote:
> This retrieves a whole page (some_url) and puts it in #products
>
> new Ajax.Updater('products', '/some_url', { method:'get' });
>
> Is there a way to retrieve a specific div on that page instead of
> getting the whole page?

Not using the Ajax.Updater - you could cook something up on top of 
Ajax.Request - if the data returned from the URL is XHTML, you could read it 
with responseXML, use XPath to extract the chunk(s) of content and assign 
them to different on-screen elements. All of which is a bit involved...

I'm not sure what problem you're trying to solve, but the Rico.AjaxEngine may 
be a decent fit - it lets you construct responses composed of multiple chunks 
of content and/or data, and then extracts and forwards them to registered DOM 
elements and/or JS objects when the response comes in. Rico's built on top of 
Prototype, so should be broadly familiar. Docs here...

http://openrico.org/docs/RicoAjaxEngine.pdf

(found via Google - I don't see much mention of AjaxEngine on the Rico site, 
looking just now. but it's still in the code for the latest download.)

FWIW my own experience of using the AjaxEngine is that it's rather verbose to 
set up - URLs, recipient DOM nodes, etc. all need to be explicitly registered 
- but once it's set up, it's pretty useful.

Dave




-- 
----------------------
Author
Ajax in Action http://manning.com/crane
Ajax in Practice http://manning.com/crane2
Prototype & Scriptaculous Quickly http://manning.com/crane3

--~--~---------~--~----~------------~-------~--~----~
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 [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-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to