var xhr = new goog.net.XhrIo();
goog.events.listen(xhr, goog.net.EventType.COMPLETE, function(e) {
obj = this.getResponseText();
console.info(obj);
});
xhr.send('blah.html');
But it's not working, errors show:
goog.debug.Logger is undefined
Doesn't the xhrio.js file include the logger?
Please help.
Was there an error message or something when you compiled your code?
(I'm guessing the "goog.debug.Logger is undefined" message was at
runtime, not compile time... but I'm just guessing.)
-Larry H.
my.custom.nameSpace.doIt = function() {
var xhr = new goog.net.XhrIo();
var onTemplateLoad = goog.bind(this.loadTemplate, this);
goog.events.listen(xhr, goog.net.EventType.COMPLETE,
onTemplateLoad, true);
xhr.send('template.html');
};
my.custom.nameSpace.prototype.loadTemplate = function(e) {
var xhr = e.target;
iframeContent = '<!DOCTYPE html><html><head></head><body>' +
xhr.getResponseText() + '</body></html>';
// this.iframe_ was set in constructor
var doc = goog.dom.getFrameContentDocument(this.iframe_);
doc.open();
doc.write(iframeContent);
doc.close();
};