I am trying to access data from an MVC controller that is on an IIS Server located within my domain. I'm getting this error
"No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:22205' is therefore not allowed access. "
Here is my ajax call:
binDropDownDataSource: new kendo.data.DataSource({
autobind: false,
serverFiltering: true,
dataType: "json",
crossDomain: true,
transport: {
read: {
cache: false,
//url: "/LogisticsWebApp/Requisitions/GetBins", This works if unremarked
url: "https://www.MyDomain.com/LogisticsWebApp/requisitions/getsites",
xhrFields: {
withCredentials: true
},
data: function () {
{
siteCode: viewModel.site.SiteCode,
shopCode: viewModel.binShopBlock.ShopCode
};
}
}
}
})
Here is my controller:
public JsonResult GetBins(string siteCode, string shopCode)
{
var lookups = new Lookups();
var data = lookups.GetBins(siteCode,shopCode);
return Json(data, JsonRequestBehavior.AllowGet);
}
I want to be able to use an application as my data layer but need to be able to develop against it.