I have a WCF service hosted/published on the below path -
newslettersubscriptiondev.mercola.com/NewsletterSubscriptionService.svc
Want to call above WCF service in Jquery Ajax Call
Code written in jQuery -
<script type="text/javascript" src="JS/jquery-2.1.4.js"></script>
<script type="text/javascript" src="JS/jquery-2.1.4.min.js"></script>
<script type="text/javascript">
function cityClickJQuery() {
$.ajax({
type: "POST",
url: "http://newslettersubscriptiondev.mercola.com/NewsletterSubscriptionService.svc/CheckEmailaddressValidateOnly",
data: { EmaillAddress: '[email protected]', Source: 'ArticleBody' },
processData: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert('success');
alert(data.d);
},
error: function (jqXHR, textStatus, errorThrown) {
console.log(JSON.stringify(jqXHR));
console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
alert(jqXHR);
}
});
}
</script>
In the above JS code CheckEmailaddressValidateOnly is the C# method defined in Service which requires 2 parameters.
Design code -
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btn1" runat="server" OnClientClick="cityClickJQuery();" Text="click" />
</div>
</form>
</body>
Above JS code is not working.
Please Help.
emaillAddresswith two l's?emaillAddresswhich i passed as a parameter is used as a parameter in[OperationContract]of interface or should i use the actual parameter passed to the method? i am totally confused.