When I try to call wcf service from $.ajax
method I am getting following Exceptions.
1. Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
2. Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the requested resource.
AJAX Coding
$.ajax({
type: "POST",
dataType: "json",
contentType: "application/json",
data: JSON.stringify(request),
async: false,
url: "http://localhost:65201/Empservice.svc/getEmployee",
crossdomain: true,
success: function (data) {
try {
response = data;
}
catch (e) {
alert(e);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("Excpetion " + errorThrown + XMLHttpRequest);
}
});