I must be missing something. I have a simple jquery autocomplete:
$("input#txtApplicationName").autocomplete({
source: "ApplicationProcess.php",
minLength: 2,
select: function (event, ui) {
alert(ui.item.id);
alert(ui.item.name);
//$('#state_id').val(ui.item.id);
//$('#abbrev').val(ui.item.abbrev);
}
});
And here is the full contents of ApplicationProcess.php:
<?
echo '[{"id":1,"name":"Generate Ideas"},{"id":2,"name":"Define Products"}]';
?>
When I type text into my autocomplete field (txtApplicationName), I get nothing. No hints appear below the box.
And just so you know that my js and html is fine, if I substitute the jquery above with this:
$("input#txtApplicationName").autocomplete({
source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});
...it works fine.
What am I doing wrong? Is the JSON in my php malformed or something? If I hit that php file directly from the browser, it spits out the JSON as expected, no errors.