Good Evening all
i am trying to post data coming from a form to the server and return a string , when i test this service works nicely. Its a Rest web api. now iam consuming it in Javascript Ajax like this
<script type="text/javascript">
function ProcessRegistration() {
jQuery.support.cors = true;$.getJSON("http://www.mydomain.mymaindomain.com/api/Registration/Create", function (data) {
alert(data);
});
} </script> When i run this and i get an Error
Failed to load resource: the server responded with a status of 405 (Method Not Allowed)http://www.mydomain.mymaindomain.com/api/Registration/Create
i have added the headers in IIS
"Access-Control-Allow-Origin" "*"
in my web config of the service i have added
<system.webServer><httpProtocol><customHeaders><add name="Access-Control-Allow-Origin" value="*" /></customHeaders></httpProtocol><...........
i have done all suggested by my research but i still get that error, try to restart the server but still the same.