This js fire server side api call and C# successfully return too but it come in error function in js. and i can not see result in response error.
JS
$.ajax({
url: "http://127.0.0.1:81/api/sites/GetDomainAvailability?apikey=asfasfdsf&callback=?",
data: { subDomain: subDomain, parentDomain: parentDomain, resellerId: resellerId },
contentType: 'application/json; charset=utf-8',
accept: 'application/json',
dataType: 'json',
success: function (response) {
if (callback)
callback(response.d);
},
error: function (response) {
if (callback)
error(response.d);
}
});
C# Code
[HttpGet]
public HttpResponseMessage GetDomainAvailability(string subDomain, string parentDomain, string resellerId)
{
if (ModelState.IsValid)
{
var domain = string.Format("{0}.{1}", subDomain, parentDomain);
var manager = new CloudSitesManager();
var isDomainAvailable = manager.GetDomainAvailability(domain);
var response = Request.CreateResponse(HttpStatusCode.OK, isDomainAvailable);
return response;
}
else
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
}