jquery file upload - IE done callback data.result issue

后端 未结 8 719
借酒劲吻你
借酒劲吻你 2020-12-01 05:41

I\'m using jQuery file upload plugin.

I don\'t use the UI part, only basic one.

When I do the following, I\'m having an issue in

相关标签:
8条回答
  • 2020-12-01 06:12

    I ran into this same issue. IE 9 would not trigger the done callback, but would trigger the always callback. The tricky part was extracting the JSON response object from the arguments. (Despite what the documentation claimed, I did not find that I needed to include jquery.iframe-transport.js.)

    My implementation of the always callback looked something like this:

    always: function(e, data) {
      var result;
      if (data.textStatus == 'parsererror') {  // IE9 fails on upload's JSON response
        result = JSON.parse(data.jqXHR.responseText);
      } else if (data.textStatus == 'success') {
        result = data.result;
      }
    
      if (result) {
        // ...perform custom handling...
      }
    }
    
    0 讨论(0)
  • 2020-12-01 06:12

    I believe issue can be in server response, you can make sure that server always send correct heading by using following code:

    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    header("Content-type: text/x-json");
    echo json_encode($array);
    exit(0);
    
    0 讨论(0)
提交回复
热议问题