I am using this wonderful plugin developed by Devbridge. Using your examples one works well and the other does not:
The one that works:
// Obtengo listaDeProfesionales desde /profesionales/get_lista/
$('#autocompleteInput').autocomplete({
lookup: listaDeProfesionales,
});
The one that does not work:
$('#autocompleteInput').autocomplete({
serviceUrl: "/profesionales/get_lista/",
});
I get this error on the screen:
Uncaught TypeError: Cannot read property 'length' of undefined
In the plugin file
jquery.autocomplete-devbridge.js:792
I do not understand why, since it is the same source of information, only that one is stored locally and the other is via AJAX. /profesionales/get_lista/
returns a JSON in the {value: "..", data: any}
format as requested by the plugin.
According to the documentation, the serviceURL parameter must provide the URL that returns a serviceUrl string. From what I see, I'm not really understanding what it's supposed to be.