我的 EC2 实例上有一个运行良好的 PHP 脚本,这里只是为了向您展示我直接从浏览器运行它时的输出:

但是当我尝试通过 AJAX 抓取它时,它就不起作用了。这是我的 JavaScript 代码:
$.ajax({
url: "http://ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com/mypage/proxy.php",
data: {symbol: symbol,
which_website: "yahoo",
host_name: "finance.yahoo.com",
company_name: yahooCompanyName,
ten_day_volume: yahoo10DayVolume,
total_volume: totalVolume,
yesterday_volume: yesterdayVolume
},
async: false,
crossDomain: true,
dataType: 'html',
success: function (data) {
// etc...
},
error: function (jqXHR, exception) {
var msg = '';
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.';
} else if (jqXHR.status == 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
alert(msg);
}
它总是返回“未连接。\n 验证网络”。
如果我查看我的网络响应,看起来响应被截断了:
我必须配置我的浏览器还是什么?
