I have this error
XMLHttpRequest cannot load
http://localhost:81/Test/Service.svc/SetJSON. Originhttp://localhost:1716is not allowed by Access-Control-Allow-Origin.
when I calls wcf web service using jquery.
$.ajax({
type: 'POST',
url: webmethod,
data: '{"data":"Darshana"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert(msg.d);
},
error: function (e) {
alert("Unavailable");
}
});
why is that?
any help. thanx..
I don’t remember how I got this error and when. But, as lots of people having this problem I thought to post what I did.
WCF – IService
WCF – Service
WCF – web.config
Jquery call
not 100% sure what solved my problem. Anyway this will help someone. 🙂