Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript S3发出POST请求的静态网站_Javascript_Post_Amazon S3_Static - Fatal编程技术网

Javascript S3发出POST请求的静态网站

Javascript S3发出POST请求的静态网站,javascript,post,amazon-s3,static,Javascript,Post,Amazon S3,Static,是否可以从S3上托管的静态网站发出POSt请求?有什么解决方法吗?完全可能,只需使用XMLHttpRequest或添加一些库(jquery)来帮助您: <script> var xhr = new XMLHttpRequest(); xhr.open("POST", '/server', true); //Send the proper header information along with the request xhr.setRequestH

是否可以从S3上托管的静态网站发出POSt请求?有什么解决方法吗?

完全可能,只需使用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>

var xhr=new XMLHttpRequest();
xhr.open(“POST”,“/server”,true);
//随请求一起发送正确的标头信息
setRequestHeader(“内容类型”,“应用程序/x-www-form-urlencoded”);
xhr.onreadystatechange=function(){//在状态更改时调用函数。
if(this.readyState==XMLHttpRequest.DONE&&this.status==200){
//请求已完成。请在此处进行处理。
}
}
发送(“foo=bar&lorem=ipsum”);
//send(新的Int8Array());
//发送(文件);