I am working on JQuery AutoComplete on my ASP.NET page. And, I am using ashx file to populate list.
But, the ashx looks like it’s not firing. I am not sure what I am doing wrong.
jQuery code
$(function () {
$("#<%=txtBox.ClientID%>").autocomplete('MyList.ashx', { minChars: 1 });
});
.ashx code
[WebService(Namespace = "http://www.yoursite.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class MyList: IHttpHandler
{
public void ProcessRequest(HttpContext context) {
//Just to test
context.Response.Write("test");
}
}
Set MIME content-type for the ashx to return json data.
Also, specify json as the data type for the source to autocomplete.