Try this
var _url = '@Url.Action("GetCurrentAlarms" ,"Home")';
$.ajax({
url: _url,
dataType: "json",
type: "GET",
contentType: 'application/json; charset=utf-8',
success: function (data) {
onSuccess(data);
},
error: function (xhr) {
debugger;
alert('error');
}
});
});
var arr = [];
var onSuccess = function (data) {
arr = data;
alert(arr);
};