The easiest way is to make the server return only the spefic element you need,
instead of a complete page. 

It depends on the web dev frameworks of your choice on how easy this is to
implement, though. For example, with Rails and many other MVC frameworks,
you've partials (generating HTML snippets) that you can use both for Ajax (update specifc
parts of the page) and non-Ajax (complete page that's composited from a layout
and one or more partials) HTML rendering.

If you want to do it the hard way, you can use string manipulation in _javascript_, of course.

-Thomas

Am 27.06.2006 um 07:47 schrieb Sam:

After retrieving a URL using an Ajax.Request...
 
function onComplete (request, json) {
// request.responseText holds the entire page
 
Only the content contained in elementID = 'source' is intended for display
 
At this time, the following code works, but it disturbingly copies the entire page from the source URL into the target DIV
 
$('target').innerHTML = request.responseText; // copy the entire page
$('target').innerHTML = $('source').innerHTML; // remove everything bur the content of element 'source'
 
Any suggestion for a method to copy only the innerHTML of 'source'  ?
 
Sam
 
 
 
_______________________________________________
Rails-spinoffs mailing list

--
Thomas Fuchs
wollzelle


questentier on AIM
madrobby on irc.freenode.net
 
http://www.fluxiom.com :: online digital asset management
http://script.aculo.us :: Web 2.0 _javascript_
http://mir.aculo.us :: Where no web developer has gone before




_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to