Simple-Ajax-Uploader
Simple-Ajax-Uploader copied to clipboard
server response warped in <pre> tag
First of all thanks for create this plugin, when i want to upload file with iframe method, I get server response like this:
<pre>{success: true, message: 'done'}</pre>
and because of this type of message, parseJSON function can't parse this response to JSON, I've fixed it with this method but i'm not sure this is right solution or no
var serverResponse = response;
response = ss.parseJSON(response);
// if file uploaded with iframe and parseJSON doesn't work
if (response === false && !XhrOk) {
var el = document.createElement("html");
el.innerHTML=serverResponse;
var tag = el.getElementsByTagName("pre")
var innerHTML = tag[0].innerHTML;
response = ss.parseJSON(innerHTML);
}
<pre>
-Tags are usually produced by debug code. Are you using a framework and your debug mode is on?