Simple-Ajax-Uploader icon indicating copy to clipboard operation
Simple-Ajax-Uploader copied to clipboard

server response warped in <pre> tag

Open derakhshanfar opened this issue 6 years ago • 1 comments

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);
        }

derakhshanfar avatar Jul 14 '18 04:07 derakhshanfar

<pre>-Tags are usually produced by debug code. Are you using a framework and your debug mode is on?

markusramsak avatar Dec 11 '18 21:12 markusramsak