B
B
BonBon Slick2017-04-13 01:09:54
JavaScript
BonBon Slick, 2017-04-13 01:09:54

Vimeo API CORS problem with POST method?

Ajax request:

$.ajax({
                url: uploadUrl,
                data: formData,
                cache: false,
                contentType: false,
                processData: false,
                type: 'POST',

                xhr: function () {
                    var myXhr = $.ajaxSettings.xhr();
                    if (myXhr.upload) {
                        myXhr.upload.addEventListener('progress', function (e) {
                            if (e.lengthComputable) {
                                $('progress').attr({
                                    value: e.loaded,
                                    max: e.total,
                                });
                            }
                        }, false);
                    }
                    return myXhr;
                },
                complete: function (response) {
                    window.location.href = "/тут_юрл_который_надо_для_завершения_закачки";
                }
            });


But it throws an error:
XMLHttpRequest cannot load 
https://1511923755.cloud.vimeo.com/upload?ticket_id=f30af9126173c3ae4db3e27…token%253DoAnNVHIGKL5kn4lRTFi5P5pvva5cjCcwdsmegsAd33o2uxQckwBYGaXcUnJ1SaJ7. 

//надо сюда перевести после запроса
Redirect from 'https://1511923755.cloud.vimeo.com/upload?ticket_id=f30af9126173c3ae4db3e27…token%253DoAnNVHIGKL5kn4lRTFi5P5pvva5cjCcwdsmegsAd33o2uxQckwBYGaXcUnJ1SaJ7' 

to 'https://vimeo.com/upload/api?video_file_id=732166719&app_id=100418&ticket_i…3Ftoken%3DoAnNVHIGKL5kn4lRTFi5P5pvva5cjCcwdsmegsAd33o2uxQckwBYGaXcUnJ1SaJ7' 

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://musicians' is therefore not allowed access.


What's in Headers:
ticket_id:0dfbb06....db9a129773082
video_file_id:732096843
signature:4306bd26....50d7f6239
v6:1
 // этот ЮРЛ, надо на него перевести, но как?
redirect_url:https://vimeo.com/upload/api?...

video_file_id=732096843&app_id=10041......wMN0QJGRtMpWoAjouzkdrY


Yes, I googled, I saw this and a couple more, and I also saw the library on github.

Is it possible to do without the PUT / third-party library method? If so, how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Argumentus, 2017-04-13
@Argumentus

as I understand it, the site to which you make an ajax request does not return a header with Access-Control-Allow-Origin

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question