Postメソッドを使用してJavascriptから大きなリクエストデータを含むPhpファイルにクロスドメインリクエストを送信するにはどうすればよいですか?
$ .ajax、$。postで試しましたが、POSTのアラートが失敗したのと同じ問題があります。
これがデスクトップにJavascriptを含む私のHTMLファイル[call.html]です::
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$.ajax({
    type: 'POST',
    url: 'http://localhost/GP/ALternate/file.php',
    crossDomain: true,
    data: '{"l":2}',
    dataType: 'json',
    success: function(responseData, textStatus, jqXHR) {
        var value = responseData.someKey;
    alert(value);
  //document.getElementById('w').innerHTML = value.d;
        },
    error: function (responseData, textStatus, errorThrown) {
        alert('POST failed.');
    }
});
</script>
<div id ='w'></div>
</body>
</html>
これがローカルホストでの私のphp[file.php]スクリプトです。
<?php
    header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
    header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
    header('Access-Control-Max-Age: 1000');
    header('Access-Control-Allow-Headers: Content-Type');
 $f= $_GET["l"]; 
 echo "{'d' : '".$f."'}";
?>