在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地图中的点击侦听器调用
gm.event.addListener(marker[realtyId], 'click', function () {
infoWindow[realtyId].open(map, marker[realtyId]);
popupOpen({ realty_id: realtyId }, realtyId === 0 ? pageO.modify : pageO.advert);
});
答案 0 :(得分:12)
由于目标网址有advert
个世界Adblock Plus阻止了它。在投入生产之前,它发生在我身上。
答案 1 :(得分:0)
我在node.js中遇到类似的问题,我的路由是/ api / getads,AJAX调用在它进入服务器之前就遇到了错误逻辑。将路径网址更改为/ api / getspn(赞助商的简称)修复了问题。
请勿使用包含“广告”的网址或路由,因为它会与Firefox的反广告插件冲突。