I test the same script, run well in windows, but failed in CentOS.
1.php
<?php
header("Access-Control-Allow-Origin: http://MY-SERVER-PROVIDE-IP");
echo $_POST['name'];
?>
2.php
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js?ver=1.6.4'></script>
<script type="text/javascript">
jQuery(document).ready(function(){
$.ajax({
url: "http://MY-SERVER-PROVIDE-IP/1.php",
dataType: "html",
type: 'POST',
data: "name=123456|abcdef",
success: function(data){
$("#result").html(data);
}
});
});
</script>
<div id="result"></div>
The code is very basic, I check it in chrome network Hearders. all the thing are same, but the Response Header is different.
windows return Connection:Keep-Alive
CentOS return Connection:close
Where is the possible wrong?
BYW: Windows is on localhost, CentOS is new install, with php5.3 witch is place on a server(During the test, I have never use domain name, but a IP address).
And if change POST to GET, I can get value. I am not run as a Cross Domain post, why can not get the POST value?
Thanks.