New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
A-contresens opened this Issue Nov 3, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@A-contresens

A-contresens commented Nov 3, 2015

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('');
                }
            }
        });
    }
);
@running-coder

This comment has been minimized.

Owner

running-coder commented Nov 3, 2015

Hey, thanks for reporting this issue as I thought it may still occurs... this issue is related to #93, and was partially fixed. Perhaps I'm not calling the abort() method on the proper object according to the jQuery doc http://api.jquery.com/jquery.ajax/. I'll have to double check it.

May I ask which version of jQuery you are using?

@running-coder

This comment has been minimized.

Owner

running-coder commented Nov 3, 2015

I've committed a fix inside the develop branch, lmk if it solved the issue

Thanks

@A-contresens

This comment has been minimized.

A-contresens commented Nov 3, 2015

It is working.

Thank you very much

@A-contresens A-contresens reopened this Nov 3, 2015

@running-coder

This comment has been minimized.

Owner

running-coder commented Nov 3, 2015

perfect, will include this fix in the next release

@running-coder running-coder added this to the 2.2.0 milestone Nov 3, 2015

running-coder pushed a commit that referenced this issue Nov 10, 2015

tom bertrand
Version 2.2.0
#76, #95 Added groupOrder option
#80 Option to use a function to resolve group label
#90 options.cache< now accepts "true", "localStorage" or "sessionStorage"
#102 Add UMD wrapper

Fixes
#101 Uncaught TypeError: this.xhr[i].abort is not a function
#103 Typo in dropdownCarret option, now dropdownCaret

running-coder pushed a commit that referenced this issue Nov 10, 2015

tom bertrand
Version 2.2.0
#76, #95 Added groupOrder option
#80 Option to use a function to resolve group label
#90 options.cache< now accepts "true", "localStorage" or "sessionStorage"
#102 Add UMD wrapper

Fixes
#101 Uncaught TypeError: this.xhr[i].abort is not a function
#103 Typo in dropdownCarret option, now dropdownCaret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment