JSFiddle - React, Tailwind, and code Playground
by SchmalzyB
JavaScript
var something = [];
$.getJSON("http://co-web-947.na.plexus.com:8088/api/AD/SearchForUsersByFullName/Boise.XP08014", function (data) {
alert("here");
something = data;
if (data.length) {
alert("success");
}
else {
alert("fail");
}
})
.success(function () { alert("second success"); })
.error(function () { alert("error"); })
.complete(function () { alert("complete"); })
.done(function (data) {
alert("it's done");
if (data[0].EmpId == "") {
alert("Should be blank");
var url = '@Url.Action("GenericLogin", "Recognition")';
window.location.href = url;
}
else {
alert(data[0].EmpId.toString());
$("#SubmittingEmployee_EmployeeId").val(data[0].EmpId);
}
alert("in the .done loop");
alert(data[0].EmpId.toString());
}).fail(function () {
alert("Failed");
}).always(function () {
alert("in the always loop");
alert(data[0].EmpId.toString());
});
if (!something.length) {
alert('there was no data');
}