remote request with php jQuery-autoComplete

1

I'm trying to remotely request a PHP file with the jQuery-autoComplete , but it is not working. The plugin in question is the one here: jQuery-autoComplete . I want to use it for being very simple, light and meets what I need.

The request is made like this:

$('input[name="q"]').autoComplete({
minChars: 2,
source: function(term, suggest){
    term = term.toLowerCase();
    var choices = ['ActionScript', 'AppleScript', 'Asp', ...];
    var matches = [];
    for (i=0; i<choices.length; i++)
        if (~choices[i].toLowerCase().indexOf(term)) matches.push(choices[i]);
    suggest(matches);
}
});

No var choices I need to put the file PHP that will return the result. The problem is that it does not work. I've already taken a look at the documentation and do not have a complete example. Can anyone help me with this?

    
asked by anonymous 27.12.2016 / 20:48

1 answer

1

The jQuery-autoComplete , has a basic request template that can be done like this:

28.12.2016 / 01:45