Skip to content

Uncaught TypeError: this.xhr[i].abort is not a function #101

@A-contresens

Description

@A-contresens

It occurs when an user enter a new search in the field and previous query is not yet completed.

In the previous released, it was working fine (2.1.2). I don't manage to reproduce the problem.

If you need any more explanation, feel free to ask.

capture d ecran 2015-11-03 a 16 21 05

My configuration :

$.getJSON('\x2Fsearch\x2Fcountries.json', function(data) {
        var countryData = data;

        $.typeahead({
            input: "#q",
            minLength: 2,
            maxItem: 15,
            accent: true,
            hint: true,
            debug: false,
            dynamic: true,
            display: ["name"],
            correlativeTemplate: true,
            delay: 300,
            offset: false,
            group: [true, "{{group}}"],
            emptyTemplate: 'Aucun\x20r\u00E9sultat\x20pour "{{query}}"',
            mustSelectItem: true,
            source: {
                "Guide pays": {
                    data : countryData,
                    template: '<span>' +
                        '<span class="name">{{name}}</span>' +
                        '<span class="country-flag">' +
                            '<img src="{{img}}">' +
                        '</span>' +
                    '</span>'
                },
                "Guide ville":{
                    url: [{
                        type: "POST",
                        url: "\x2Fsearch\x2Fcities.json",

                        data: {
                            q: "{{query}}"
                        },
                    }, "data.city"],
                    template: '<span>' +
                        '<span class="name">{{name}}, <i>{{regionName}}</i></span>' +
                        '<span class="text-sm text-default">{{countryName}}</span>' +
                        '<span class="country-flag">' +
                            '<img src="{{img}}">' +
                        '</span>' +
                    '</span>'
                }, 
            },
            callback: {
                onClick: function (node, a, item, event) {
                    window.location.replace(
                        item.url
                    );
                },
                onSendRequest: function(node, query) {
                    $(".typeahead-spinner").html('<i class="fa fa-spinner fa-spin"></i>');
                },
                onReceiveRequest: function(node, query) {
                    $(".typeahead-spinner").html('');
                }
            }
        });
    }
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions