S3 stati c веб-сайт, который делает запрос POST - PullRequest
0 голосов
/ 02 марта 2020

Можно ли сделать запрос POSt с сайта c, размещенного на S3? Есть ли обходные пути?

1 Ответ

0 голосов
/ 02 марта 2020

Вполне возможно, просто используйте XMLHttpRequest или добавьте несколько библиотек (jquery), чтобы помочь вам с этим:

<script>
    var xhr = new XMLHttpRequest();
    xhr.open("POST", '/server', true);

    //Send the proper header information along with the request
    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

    xhr.onreadystatechange = function() { // Call a function when the state changes.
        if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
            // Request finished. Do processing here.
        }
    }
    xhr.send("foo=bar&lorem=ipsum");
    // xhr.send(new Int8Array()); 
    // xhr.send(document);

</script>

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send

...