JQuery视频上传返回成功消息但错误事件正在触发

时间:2015-11-03 10:22:37

标签: javascript jquery ajax wistia

我有用于在wistia服务器上传视频的API。我使用Ajax jquery将视频发布到服务器,视频上传到服务器,成功消息即将到来。但问题是错误事件在成功事件中没有被解雇。

HTML:

<form enctype="multipart/form-data">
    <input id="File1" type="file" />
    <input id="Submit1" type="button" value="save video" onclick="SaveFile();" />
</form>

JQuery的:

function SaveFile() {
        alert('111111');           
        var pData = new FormData();
        var files = $("#File1").get(0).files;
        pData.append("project_id", "*******");           
        pData.append("file", files[0]);           
        $.ajax({
            url: 'https://upload.wistia.com/?access_token=***************',
            type: 'POST',
            data: pData,
            processData: false,
            contentType: false,
            dataType: 'multipart/form-data',
            async: false,
            success: function (data) {                   
                alert('success');
            },
            error: function (e) {                    
                alert(JSON.stringify(e));
                alert('error');                    
            }
        }).done(function () {
            alert('Done');
        });

响应:

{"readyState":4,"responseText":"{\"id\":16549615,\"name\":\"VID-20151103-WA0000.mp4\",\"type\":\"Video\",\"created\":\"2015-11-03T10:28:25+00:00\",\"updated\":\"2015-11-03T10:28:25+00:00\",\"duration\":112.046,\"hashed_id\":\"********\",\"description\":\"\",\"progress\":0.0,\"status\":\"queued\",\"thumbnail\":{\"url\":\"https://embed-ssl.wistia.com/deliveries/5b83b5db28f38876963829e0de30039d52eb80bc.jpg?image_crop_resized=100x60&video_still_time=56\",\"width\":100,\"height\":60},\"account_id\":******}","status":200,"statusText":"OK"}

这是错误事件。

0 个答案:

没有答案