最近创建了一个WCF REST Service Application 想通过JQuery Ajax调用,除了get方法可以外,POST\PUT\DELETE都不行,REST服务的配置文件基本没改动,通过Fiddler模拟请求和HttpClient都是可以的,不知道啥原因,请各位大侠指点一二!!!
你要正确设置type为Post,服务的地址url,data,还有contentType与dataType等。你可以将includeExceptionDetailInFaults = "true"看下有没有抛出什么错误信息,把你的代码及配置文件贴出来看下。这里有一篇关于用Jquery调用WCF REST Service,也是采用POST方式,你可以参考下。
http://www.codeproject.com/Articles/59551/Consuming-a-WCF-ASMX-REST-Service-using-jQuery#2
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework