On Jun 13, 10:04 pm, fufolewe <[email protected]> wrote:
> Hi,
>
> I have a simple problem which is driving me nuts:
>
> I would like to make an AJAX req which returns the whole page - select
> an element by its ID from the response text and update "targetDiv"
> with this element (myDivID).
>
> But it doenst work :/
>
Unfortunately "doesn't work" doesn't tell us anything. If you want
help on a problem where something "doesn't work", TELL US WHAT
ACTUALLY HAPPENS!

But I can possibly guess. 'getElementById'  is  a method of Document,
not of String. You're sort of expecting your browser to take a string,
guess that it represents some DOM, and analyse that DOM on the fly.
But it won't. You can't use 'getElementById' to find an element until
that element is in the document's DOM.

If the element you want is already in the document before your Ajax
call, then

 var element = document.getElementById( 'myDivID');
will do (or the shorter Prototype version
 var element = $('myDivID');
)

If it's not, then you'll have to explain what you're trying to do.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to