在 Firefox 27.0.1、Fedora 20、jQuery 1.11.0 中执行 GET 同步 ajax 请求时:
$.ajax(ajaxParam).then(
function (r) {
html = r.html;
},
function (jqXHR) {
console.log(JSON.stringify([jqXHR, $.ajaxSettings, ajaxParam], null, 4));
}
);
它适用于 Linux 的 Chrome 33.0.1750.146,但在 Firefox 中,没有请求发送到服务器,并且出现错误:
[
{
"readyState": 0,
"status": 0,
"statusText": "[Exception... \"<no message>\" nsresult: \"0x805e0006 (<unknown>)\" location: \"JS frame :: http://example.com/static/jquery-1.11.0.min.js :: .send :: line 4\" data: no]"
},
{
"url": "http://example.com/pt/BR",
"type": "GET",
"isLocal": false,
"global": true,
"processData": true,
"async": true,
"contentType": "application/x-www-form-urlencoded; charset=UTF-8",
"accepts": {
"*": "*/*",
"text": "text/plain",
"html": "text/html",
"xml": "application/xml, text/xml",
"json": "application/json, text/javascript",
"script": "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
"contents": {
"xml": {},
"html": {},
"json": {},
"script": {}
},
"responseFields": {
"xml": "responseXML",
"text": "responseText",
"json": "responseJSON"
},
"converters": {
"text html": true
},
"flatOptions": {
"url": true,
"context": true
},
"jsonp": "callback",
"cache": false,
"traditional": true,
"dataType": "json"
},
{
"url": "/advert/pt/BR",
"data": {
"realty_id": "2"
},
"async": false,
"type": "GET"
}
]
The nserror 0x805e0006 是 NS_ERROR_CONTENT_BLOCKED http://james-ross.co.uk/mozilla/misc/nserror?0x805E0006
正在回答埃帕斯卡雷洛
该 ajax 调用位于该函数内
function popupOpen(params, page, html) {
loadScripts();
var ajaxParam = {
url: '/' + page.url + '/' + $('#lang_code').val() + '/' + $('#terr_code').val(),
data: params,
async: false,
type: page.method,
traditional: false
},
realtyId = params.realty_id;
if (!html) {
$.ajax(ajaxParam).then(
function (r) {
html = r.html;
},
function (jqXHR) {
console.log(jqXHR, $.ajaxSettings, ajaxParam);
}
);
}
popupOpen 由 Google 地图中的点击侦听器调用
gm.event.addListener(marker[realtyId], 'click', function () {
infoWindow[realtyId].open(map, marker[realtyId]);
popupOpen({ realty_id: realtyId }, realtyId === 0 ? pageO.modify : pageO.advert);
});