views:

62

answers:

2

Related Question:

http://stackoverflow.com/questions/1489402/manipulating-a-variable-containing-xml-with-jquery

I have a jsp which returns an xhtml document that looks something like this:

<root>
  <p id = "myId">Text text text <img id = "myImgId" /></p>
</root>

Now, when I pull this data into a variable via an ajax call through jQuery, and then I attempt to write this data to the page, I seem to lose the object in the dom. That is, both

$('#myId')

and

$('#myId', myXmlDoc)

return []!.

I write the value to the page as such:

$('#myDiv').append($('#myId',myXmlDoc));

Also, the img starts with no source, and it is assigned in javascript dynamically via

$('#myImgId', myXmlDoc).attr( "src", "something.png" )

But when I write the img to the page (specifically a jQuery-UI popup dialog), I don't see the image, but only the text!. If I manually add the same text string to the dialog via firebug and the console, the image seems to appear. This is VERY unusual, considering the [] return values illustrated above.

Does anyone have ANY idea what's going on? This behavior is just bizarre.

A: 

I'm a bit puzzled at this:

I have a jsp which returns an xhtml document that looks something like this: 

<root>
  <p id = "myId">Text text text <img id = "myImgId" /></p>
</root>

This may be XML, but it isn't XHTML!

Sam Dutton
A: 

You can't append to the div like that. Aside from that, I could not reproduce your issue.

Stefan Kendall
Talking to yourself again?
Crescent Fresh
I have to keep my questions-accepted percentages up. The div appending was answered in another topic (of mine, I believe, could be wrong). There were also a number of problems that all created my specific environment, all of which should have been trivial.
Stefan Kendall
This is clearly not an answer to this question, and marking what is obviously a non-answer as accepted for the sake of keeping your % up is asinine.
Daniel Schaffer
What about this answer is incorrect? Given the wording of the question, this is the only acceptable response. The method of writing to the div has to be changed, and the rest of the issues should be non-reproducible.
Stefan Kendall