jQuery AJAX リクエスト Linux Apache Server を要求すると、すべて問題ないようです。Windows XAMPP サーバーを要求している場合、Windows の一部のブラウザーでは次のように表示されます。
"Cross-origin resource sharing check [response verification]
Access denied, Origin: not matching."
両方のサーバー応答のヘッダーはまったく同じだと思うので、どこに問題があるのか わかりません。
Linux サーバーからの要求と応答のヘッダーがあります。
リクエスト:
URL:http://data.chlupac.com/livetime24/index.php/livetime/get_table/livetiming1/0/0?_=1372192293003
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,cs;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
Content-Type:text/plain
Host:data.chlupac.com
Referer:http://data.chlupac.com/livetime24/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
X-Requested-With:XMLHttpRequest
Query String Parametersview sourceview URL encoded
_:1372192293003
応答:
Access-Control-Allow-Credentials:true
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Authorization, X-Requested-With, Content-Type, Origin, Accept
Access-Control-Allow-Methods:GET, OPTIONS
Access-Control-Allow-Origin:*
Access-Control-Allow-Origin:data.chlupac.com
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:2508
Content-Type:text/html
Date:Tue, 25 Jun 2013 20:31:31 GMT
Keep-Alive:timeout=15, max=99
Server:Apache/2.2.16 (Debian)
Vary:Accept-Encoding
X-Powered-By:PHP/5.3.3-7+squeeze14
それはうまくいきます。
そして、Windowsサーバーからの私の要求と応答があります:
リクエスト:
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,cs;q=0.6
Connection:keep-alive
Content-Type:text/plain
Host:championchip.cz
Referer:http://championchip.cz/new/livetime24/livetime/index/livetiming2
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
X-Requested-With:XMLHttpRequest
応答:
Access-Control-Allow-Credentials:true
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Authorization, X-Requested-With, Content-Type, Origin, Accept
Access-Control-Allow-Methods:GET, OPTIONS
Access-Control-Allow-Origin:http://championchip.cz
Connection:Keep-Alive
Content-Type:text/html
Date:Tue, 25 Jun 2013 20:36:27 GMT
Keep-Alive:timeout=5, max=96
Server:Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8h mod_autoindex_color PHP/5.2.6
Transfer-Encoding:chunked
X-Powered-By:PHP/5.2.6
Access-Control-Allow-Origin でホストの前に「http://」を付けずに試してみましたが、うまくいきませんでした。
私が使用しているJavascriptがあります:
$.ajaxSetup({
xhrFields: {
withCredentials: true
}
});
$.support.cors = true;
val_livetime="0";
val_vysledky="0";
val_kategorie="0";
$("#vysledky").change(function () {
val_kategorie="0";
$("#vysledky option:selected").each(function () {
val_vysledky = $(this).val();
});
$.ajax({
url: "<?= site_url('livetime/get_options_kat') ?>/" + val_livetime +"/"+val_vysledky,
contentType: 'text/plain',
cache: false}).done(function(html){
$("#kategorie").html(html);
});
})
.trigger('change');
回答ありがとうございます。:)