I'm attempting to call a DomainService created using WCF Ria Services from jquery. If I use a POST I get 405 method not allowed. If I use Get, it get javascript errors. Am I missing a configuration step? This code results in the 405.
function GetSearchResults() {
$.ajax(
{
type: "POST",
url: "/Services/CustomerService.svc/GetCustomerSearchResults",
data: '{"customerId":1}',
timeout: 5000,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: Success,
error: Fail
});
}
[EnableClientAccess]
public class CustomerService : DomainService
{
public List<CustomerSearchResult> GetCustomerSearchResults(string customerId)
{
var list = new List<CustomerSearchResult>();
list.Add(new CustomerSearchResult
{
Id = 1,
Name = "Me"
});
}
return list;
}
}