I have API to upload video in wistia server. I using Ajax jquery to post video to server, video getting uploaded to server and success message is coming. But the problem is error event is getting fired nothing coming in success event.
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');
});
Response:
{"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"}
This is coming in error event.