I'm trying to get the jQuery UI AutoComplete widget working with a remote data source in a WebForms application. I have it successfully calling my web service, but the control does not pop up the list with the returned items.
Here's my markup:
<p>
<label for="birds" class="fieldLabel">Company:</label>
<input id="existingProgramCompanyName" type="text" style="width: 350px" />
</p>
And here's my script:
$("#existingProgramCompanyName").autocomplete({
source: "/Services/ProgramListServices.asmx/FilteredProgramList",
minLength: 3,
select: function (event, ui) {
alert('Got it!');
}
});
Whenever I've done this in the past, my biggest problem has been returning the data in the right format. The AutoComplete widget wants JSON and so I've spent considerable time getting my code to return valid JSON. Here's the actual string being returned from my web service:
{
"Companies":[{"Id":"1","Value":"First","Label":"First"},
{"Id":"2","Value":"Second","Label":"Second"},
{"Id":"3","Value":"Third","Label":"Third"}],
"HasData":true,"Message":"","Success":true
}
Is that valid JSON?
The control correctly shows the little animated loading image. My web service is being called and is returning without error. But the AutoComplete control never pops up the list.
Does anyone see any problems with what I have so far? And what would be the next step in trying to troubleshoot this?