I am just trying to pass a hard-coded JSON string to a WCF AJax Enabled Web Service method via GET where I want to accept it and write it to a database. I had to comment out the success function of the $.ajax in order to not et errors with Telerik's WebGrid for now. How can I just get this to the web service:
var input = '{"SbiId":"ca222cf7-be5e-431a-ab93-9a31e8ae2f4a"}';
$(document).ready(function() {
// var input ='{"SbiId":"<%=guid %>"}';
console.log(input);
$.ajax({
url: "http://www.blah.com/services/testsService.svc/GetContactsDataAndCountbyGUID",
type: "GET",
contentType: "application/json; charset=utf-8",
data: input,
dataType: "json",
<%-- success: function(data) {
var mtv = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
console.log(data);
mtv.set_dataSource(data.d.Data);
mtv.dataBind();--%>
//}
});
EDIT: The service parameter is:
[OperationContract]
[WebGet]
public ResultData GetContactsDataAndCountbyGUID(string requestGUID)
{
The config is:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="AlphaFrontEndSiteASP.TestsServiceAspNetAjaxBehavior">
<enableWebScript />
<webHttp />
</behavior>
<behavior name="AlphaFrontEndSiteASP.Services.TestsService">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MetadataBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="AlphaFrontEndSiteASP.Services.TestsService" behaviorConfiguration="MetadataBehavior">
<endpoint address="" behaviorConfiguration="AlphaFrontEndSiteASP.TestsServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="AlphaFrontEndSiteASP.Services.TestsService" />
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>