I am returning a JSON-encoded array: echo(json_encode($data));from php, and I would like it to populate a sentence field from JQuery autocomplete. I use this:
$("#field").autocomplete({
source : "SearchTest.php",
maxLength: 5
});
I don’t know why this is not working. After each keystroke, I get the data and fill in the proposal field with this data, I don’t want the autocomplete sorted and selected for me, I do this side of the server. This is currently a list of strings. Being able to customize how the data will be presented would be nice.
Edit: Changed source for publication:
$("#field").autocomplete({
source : function(request, response) {
$.post("SearchTest.php", request, response);
},
maxLength : 5
});
Getting this error now:
Uncaught TypeError: Cannot use 'in' operator to search for '1240' in
Notice: Undefined index: field in /.../SearchTest.php on line 25
Line 25: $whatTheyWantToSearch = $_POST['field'];
source
share