开发者

How to call WCF Ria Service/DomainService from Jquery?

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<Custo开发者_开发百科merSearchResult>();
        list.Add(new CustomerSearchResult
            {
              Id = 1,
                                   Name = "Me"
            });
        }

        return list;
    }

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜