I get back the responseXml as a javascript object XMLdocument. How do i parse it to just return the body? here is my code snippet:
goog.net.XhrIo.send("/blogs/create?authenticity_token="+
goog.string.urlEncode(authtoken), function(e) {
var xhr = /** @type {goog.net.XhrIo} */ (e.target);
var responseXml = xhr.getResponseXml();
var parent = goog.dom.getElement('response');
goog.dom.se开发者_如何转开发tTextContent(parent, responseXml.body); /** This returns
undefined rather than the body itself! */
}, 'POST', "&body="+goog.string.urlEncode(someHTMLContent), {
'Accept' : 'text/xml'
});
Yeah, you shouldn't need to do any parsing. The responseXml
object you get back is a Document object (API docs), so your syntax of responseXml.body
should work. I'm not sure what the problem is, here. If you post a live example we can debug further.
精彩评论