在 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"
}
]
nserror 0x805e0006 is NS_ERROR_CONTENT_BLOCKED
<小时/>回答epascarello
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 map 中的点击监听器调用
gm.event.addListener(marker[realtyId], 'click', function () {
infoWindow[realtyId].open(map, marker[realtyId]);
popupOpen({ realty_id: realtyId }, realtyId === 0 ? pageO.modify : pageO.advert);
});
最佳答案
由于目标网址有广告
世界,Adblock Plus 会阻止它。很好,在投入生产之前,这件事就发生在我身上。
关于jquery - Firefox 中未发送 Ajax 请求,错误未知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22304429/