Thanks...
WCF with Jquery
I want to consume a wcf service using Jquery. How can I achieve this.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Santhosh SubramaniamPosted Nov 28, 2013, 5:04 AM
Step 1 : Create WCF Application
Step 2 : Create Client Application
function getDetails(UserId) {
jQuery.support.cors = true;
$.ajax({
crossDomain: true,
type: "GET",
url: 'Your Service application URL',
contentType: "application/json; charset=utf-8",
dataType: "json",
data: '', //JSON.stringify(jData),
success: filldata,
error: function (xhr, reason, ex) {
var err = $.parseJSON(xhr.responseText);
if (err == null) {
alert('Error Code : ' + xhr.status + "\nError Message :" + xhr.statusText);
} else {
alert('Error Code : ' + xhr.status + "\nError Message :" + err.Message);
}
}
});
}
function filldata(data) {
var json = $.parseJSON(data);
Do Something here ;;;
}
RamchanPosted Nov 28, 2013, 5:01 AM
<script>
$(document).ready(function () {
$.ajax({
type: "POST",
url: "WCFService.svc/GetEmpdetails",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var value = JSON.stringify(response);
alert(value);
},
failure: function (response) {
alert(response.d);
}
});
});
script>
Sanjeeb LenkaPosted Nov 28, 2013, 2:52 AM
http://www.c-sharpcorner.com/UploadFile/dacca2/understand-jquey-ajax-function-call-method-in-wcf-service/
http://www.codeproject.com/Articles/132809/Calling-WCF-Services-using-jQuery
http://pranayamr.blogspot.in/2010/12/steps-to-call-wcf-service-using-jquery.html