Skip to content
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

OnSelect not trigerig #84

Open
MrDefix opened this issue May 22, 2018 · 1 comment
Open

OnSelect not trigerig #84

MrDefix opened this issue May 22, 2018 · 1 comment

Comments

@MrDefix
Copy link

MrDefix commented May 22, 2018

I have problem with onselect event which is not firing:

$('.search-autocomplete').autoComplete({
        minChars: 1,
        source: function(search, response) {
            $.ajax({
                    type: 'POST',
                    dataType: 'json',
                    url: global.ajax,
                    data: 'action=search_site&search='+search,
                    success: function(res) {
                     var users = [];
                      $.each(res.data, function(i, obj) {
                       users.push(obj.name);
                      });
                    response(users);
                    },
        onSelect: function(e, term, item){
            alert("selected!");
            }
            });
        }
});
@unnikrishnanta
Copy link

Your onSelect be outside the Ajax call. That should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants