I am using the YUI3 IO Utility to submit a form with a file. The response from the server contains HTML but it is stripped when accessed on the request object.
var form = Y.one('form');
Y.io(form.get('action'), {
method: form.get('method'),
form: {
id: form,
upload: true
},
on: {
complete: function(id, request) {
// The server returns a response like <div>response</div>
console.log(request.responseText);
// All HTML is stripped so it just prints 'response' to the console
}
}
});
Is this considered the default behaviour? I almost can’t believe that it is not possible to get the full response content …
The server also sets the content-type header properly to “text/html”.
Any help is appreciated! Thank you!
I just had a look at the YUI3 source code. The few lines that are responsible for the request object in https://raw.github.com/yui/yui3/master/src/io/js/io-upload-iframe.js are:
So as soon as the response contains a “body” node it returns the body content as “text”.
IMHO there is no chance to get the innerHTML if there is a body node. I decided to create a customized IO Upload Iframe module that adds an additional property called “responseHTML” with the innerHTML of the body node.
You can get the source from Pastebin: http://pastebin.com/WadQgNP2