Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ajax request not sent error unknown in Firefox

When doing this GET synchronous ajax request in Firefox 27.0.1, Fedora 20, jQuery 1.11.0:

$.ajax(ajaxParam).then(
    function (r) {
        html = r.html;
    },
    function (jqXHR) {
        console.log(JSON.stringify([jqXHR, $.ajaxSettings, ajaxParam], null, 4));
    }
);

it works in Chrome 33.0.1750.146 for Linux but in Firefox no request is sent to the server and it errors out:

[
    {
        "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 is NS_ERROR_CONTENT_BLOCKED


Answering to epascarello

That ajax call is inside this function

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);
            }
        );
    }

and popupOpen is called by a click listener in a 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);
});
like image 315
Clodoaldo Neto Avatar asked Mar 10 '14 15:03

Clodoaldo Neto


People also ask

What does AJAX request error mean?

Many pages send AJAX requests to a server. Because this relies on the cooperation of the server and the network between the client and the server, you can expect these AJAX errors: Your JavaScript program receives an error response instead of data; Your program has to wait too long for the response.

What is HTTP request AJAX?

AJAX stands for Asynchronous JavaScript And XML. In a nutshell, it is the use of the XMLHttpRequest object to communicate with servers. It can send and receive information in various formats, including JSON, XML, HTML, and text files.

Are AJAX requests HTTP requests?

Ajax. Ajax is the traditional way to make an asynchronous HTTP request. Data can be sent using the HTTP POST method and received using the HTTP GET method. To make an HTTP call in Ajax, you need to initialize a new XMLHttpRequest() method, specify the URL endpoint and HTTP method (in this case GET).


1 Answers

Since the target url had the advert world Adblock Plus was blocking it. Good it happened to me before going in production.

like image 79
Clodoaldo Neto Avatar answered Oct 02 '22 07:10

Clodoaldo Neto