There are a whole bunch of tutorials out there explaining how to do this, eg here and here.
Looks real easy huh? Yet I've still somehow managed to waste half a day on it without getting anything working.
Eg: the following works absolutely fine
public ActionResult FindStuff(string q)
{
return Content("test");
}
$('#MyTextBox').autocomplete("MyController/FindStuff", {
parse: function(data) {
alert('parsing');
}
});
If I change it to the following, absolutely nothing happens.
public JsonResult FindStuff(string q)
{
return Json(new { name = "test" });
}
$('#MyTextBox').autocomplete("MyController/FindStuff", {
dataType: 'json', // I've also tried with this line commented out
parse: function(data) {
alert('parsing');
}
});
So it looks like the parse
call is never being hit, i.e. I'm assuming the data load is blowing up somehow or thinks there is no data. Any ideas? Thanks.
p.s. it's the Jorn Zaefferer plugin here.