Good Day
i have a web api that i want to call on the client side and return its contents, so it s a post and i return some string. Now i have a form that will have the data to be posted as depicted below
<form name="registrationForm" method="post">
and there are other controls within the form and i have a button that triggers the post as depicted below
<input title="Register" onclick="ProcessRegistration();" style="width: 100px; height: 100px; align-self: center" type="submit" name="submit_fourth" id="submit1" value="register" />
onCick i call a function from the client side, the definition of the function is
function ProcessRegistration()
{
$.getJSON("http://www.mydomain.maindomain.com/api/Registration/Create", function (data) {
alert(data);
});
}
now when i click the button to fire the service i get the following error in the console
XMLHttpRequest cannot load http://www.mydomain.maindomain.com/api/Registration/Create. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:46506' is therefore not allowed access.
Does anyone know how to solve this ?
Thanks
Thank you for posting at Dotnetfunda
[Administrator]