Getting intermittent 500 internal server error while laoding page.
Client Side code to load Dropdown on Page whenever error occoured it is not hitting server side controller.
// Perform initial load for data for screen
self.loadData = function () {
// debugger;
//Set Current login userid
var userElement = $('#currentUserID');
var LoginUserID = parseInt(userElement[0].getAttribute("data-userid"));
self.currentUserID(LoginUserID);
// Load the refLocation_Lookup by calling the WebAPI
lorapp.ajaxGet("/api/apirefLocation/GetForDDL", null,
function (data) {
var model = ko.mapping.fromJS(data);
self.refLocation_Lookup(model.RetData());
//load category data for working out the path
self.loadCategoryData();
// Load the refDeliveryOptions_Lookup by calling the WebAPI
lorapp.ajaxGet("/api/apirefDeliveryOptions/GetForDDL", null,
function (data) {
var model = ko.mapping.fromJS(data);
self.refDeliveryOptions_Lookup(model.RetData());
//// Load the item condition by calling the WebAPI
lorapp.ajaxGet(baseItemConditionHelpAPIUrl + "/GetForDDL", null,
function (data) {
var model = ko.mapping.fromJS(data);
self.refItemCondition_Lookup(model.RetData());
// self.getItems();
//// Load the condition help calling the WebAPI
lorapp.ajaxGet(baseItemConditionHelpAPIUrl + "/GetForTooltip", null,
function (data) {
var model = ko.mapping.fromJS(data);
self.conditionHelp(model.RetData())
self.getItems();
},
function (response, json) {
toastr.error("refItemConditionToolTip: " + (json ? json.Message : response));
});
},
function (response, json) {
toastr.error("refItemCondition_Lookup: " + (json ? json.Message : response));
});
},
function (response, json) {
toastr.error("getrefDeliveryOptions_Lookup: " + (json ? json.Message : response));
});
},
function (response, json) {
toastr.error("getrefLocation_Lookup: " + (json ? json.Message : response));
});
};
Ajax Call
lorapp.ajaxGet = function (url, data, successCallback, errorCallback, isBusyCallback) { ajaxCall(url, data, 'GET', successCallback, errorCallback, isBusyCallback); };
function ajaxCall(url, data, httpVerb, successCallback, errorCallback, isBusyCallback) {
if (isBusyCallback) {
isBusyCallback(true);
}
$.ajax(url, {
data: data,
type: httpVerb,
dataType: 'json',
contentType: 'application/json',
success: function (response, textStatus) {
handleSuccess(response, textStatus, successCallback, isBusyCallback);
},
error: function (xhr, textStatus, errorThrown) {
handleError(xhr, textStatus, errorThrown, errorCallback, isBusyCallback);
}
});
}
Why Intermitenat 500 error -