1. A站上的表单代码

    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.6.4/jquery.min.js"></script>
    <script>
    function send() {
        $.ajax({
            cache: true,
            type: "POST",
            url: "http://B站域名/plus/diy.php",
            data: $('#diyform').serialize(),
            xhrFields: { withCredentials: true },
            crossDomain: true,
            success: function(data) {
                if (data == "success") {
                    alert('发送成功!');
                } else {
                    alert('发送失败!');
                }
            }
        });
    }
    </script>
    <form action="" enctype="multipart/form-data" method="post" id="diyform">
        <input type="hidden" name="action" value="post" />
        <input type="hidden" name="diyid" value="2" />
        <input type="hidden" name="do" value="2" />
        <input type="hidden" name="dede_fields" value="name,text" />
        <input type="hidden" name="dede_fieldshash" value="c2be5bb5ec45d9d01ca9f60dc469b3fb" />
        <p>姓名:<input type='text' name='name' id='name' /></p>
        <p>验证码:<input type="text" name="validate"><img src="http://B站域名/include/vdimgck.php" align="absmiddle" onclick="this.src='http://B站域名/include/vdimgck.php?tag=' + Math.random();" style="cursor:pointer;"></p>
        <div onclick="send()">提交</div>
    </form>
  2. B站上的 /plus/diy.php 文件

    • 在文件顶部加入以下代码:
      header("Access-Control-Allow-Credentials: true");
      header("Access-Control-Allow-Origin: http://A站域名");