I am trying to use Andy Matthews autocomplete for jquery mobile found here. My client service has a method that uses a parameter. I am not sure how to change my client side call to accept parameters?
Here is my client side call:
//WHERE DO I PUT INPUT PARAMETERS??
$("#searchBox").autocomplete({
method: 'POST',
target: $('#suggestions'),
source: "ClientService.svc/REST/GetStates",
link: 'target.html?term=',
minLength: 1
});
Here is my service:
[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]
public List<string> GetStates(string y)
{
List<string> x= GetData(y);
return x;
}
After taking a look at the source code, it seems that the plugin doesn’t allow passing custom
POSTparameters. What the user types in the box is sent in a parameter calledterm, but if you can’t modify your service, what I would do is modifying the following part of the code:It’s quite easy to find, as there’s just one
$.ajaxcall in the whole plugin.