以下のコードは JavaScript エラーを返します: TypeError: Response is null
注: ローカル マシンの WAMP では問題なく動作しますが、ライブ LINUX ホストでは失敗します。
何か案は?
Jクエリ
$(document).ready(function()
{
$("#run").click(function(event)
{
$('#run').hide();
$('#loader').fadeIn(1000);
$.ajax(
{
type : 'POST',
url : 'process.php',
data : 'name=jolly&surname=fish',
dataType : 'json',
success : function(response)
{
$('#loader').stop(true).fadeOut(function ()
{
if (response.status == 'goodjob')
{
$('#tick').fadeIn(1000, function ()
{
$('#script').fadeIn(1000);
});
}
else
{
$('#cross').fadeIn(1000);
}
});
},
error: function (jqXHR, textStatus, errorThrown)
{
alert(textStatus + '---' + errorThrown);
}
});
});
});
HTML
<div id="first">
<img id="run" src="run.png" />
<img id="loader" src="loader.png" style="display:none;" />
<img id="success" src="success.png" style="display:none;" />
<img id="fail" src="fail.png" style="display:none;" />
</div>
<div id="next" style="display:none;">
....
....
</div>
PHP
<?php echo json_encode(array('status' => 'goodjob')); ?>
FIREBUG からの詳細
--- ヘッダー
Response Headers
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection Keep-Alive
Content-Length 0
Content-Type text/html; charset=UTF-8
Date Thu, 30 Aug 2012 13:33:41 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT
Pragma no-cache
Proxy-Connection Keep-Alive
Server Apache/2.2.3 (Red Hat)
X-Powered-By PHP/5.1.6
Request Headers
Accept application/json, text/javascript, */*; q=0.01
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Cache-Control no-cache
Content-Length 27
Content-Type application/x-www-form-urlencoded; charset=UTF-8
Cookie MoodleSession=7uck9j6n2ff7r9vc63tvt85t43; MoodleSessionTest=q0Ywtc2psj; MOODLEID_=%25E2%25C8%2513E%25BD
Host 192.168.10.11
Pragma no-cache
Proxy-Connection keep-alive
Referer http://192.168.10.11/portal/update-database/index.php
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1
X-Requested-With XMLHttpRequest
- - 役職
Parameters application/x-www-form-urlencoded
name jolly
surname fish
Source
name=jolly&surname=fish