function RealizaConsultaNotificacion(operacion, pStringJson) {
$.ajax({
timeout: 60000,
url: 'http://74.208.98.86:7070/OriginacionWS',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
dataType: 'json',
type: 'POST',
data: pStringJson,
success: function (data) {
var data1 = JSON.parse(data);
if (data1[0].estatus == "0") {
$("#lblNoNotificaciones").html("0");
$("#AnimatedBellNoti").removeClass("icon-animated-bell");
$("#lblDscNotificaciones").html("");
$("#lblDscNotificaciones").append("<i class='ace-icon fa fa-exclamation-triangle'>" + " " + "No hay notificaciones recientes para mostrar" + "</i>");
$("#LinkNotifications").hide();
//$("#lstNotificacionesMenuPanelS").append("<li><a href='#'><div class='clearfix'><span class='pull-left'><i class='btn btn-xs no-hover btn-success fa fa-line-chart' style='width: 25px; height: 20px;'></i>" + data1[0].desc + "</span><span class='pull-right badgeNoti badge-info'></span></div></a></li>");
} else if (data1[0].estatus == "-1") {
console.log("hubo un error en las notificaciones");
} else {
var conter = 0;
for (var i = 0; i < data1.length; i++) { // total de las notificaciones
if (data1[i].estado == "1") { // si la notificacion es nueva..
conter++
$("#lblNoNotificaciones").html(conter);
$("#AnimatedBellNoti").addClass("icon-animated-bell");
$("#lblDscNotificaciones").html("");
$("#lblDscNotificaciones").append("<i class='ace-icon fa fa-asterisk'>" + " " + "Tienes" + " " + conter + " " + " notificaciones" + "</i>");
switch (data1[i].tipomensaje) { // tipo de mensaje como advertencia, informativo etc..
case "1":
$("#lstNotificacionesMenuPanelS").append("<li><div class='clearfix'><span class='pull-left'><i class='glyphicon glyphicon-ok' style='width:22px;height:17px;color:white;background-color:green;border-radius:7px;'></i>" + " " + data1[i].mensaje + "</span></div></li>");
break;
case "2":
$("#lstNotificacionesMenuPanelS").append("<li><div class='clearfix'><span class='pull-left'><i class='glyphicon glyphicon-remove' style='width:22px;height:17px;color:white;background-color:rgba(195, 2, 2, 0.71);border-radius:7px;'></i>" + " " + data1[i].mensaje + "</span></div></li>");
break;
case "3":
$("#lstNotificacionesMenuPanelS").append("<li><div class='clearfix'><span class='pull-left'><i class='fa fa-info' style='width:22px;height:17px;color:white;background-color:blue;border-radius:7px;'></i>" + " " + data1[i].mensaje + "</span></div></li>");
break;
case "4":
$("#lstNotificacionesMenuPanelS").append("<li><div class='clearfix'><span class='pull-left'><i class='fa fa-exclamation-triangle' style='width:22px;height:17px;color:white;background-color:yellow;border-radius:7px;'></i>" + " " + data1[i].mensaje + "</span></div></li>");
break;
}
} else {
$("#AnimatedBellNoti").removeClass("icon-animated-bell");
$("#lblDscNotificaciones").html("");
$("#lblDscNotificaciones").append("<i class='ace-icon fa fa-exclamation-triangle'>" + " " + "No hay notificaciones recientes para mostrar" + "</i>");
$("#LinkNotifications").hide();
$("#LinkClearNotifications").hide();
}
}
return
}
},
error: function () {
console.log("Algo salio mal");
},
async: false
});
return;
}
// my question is when this function becomes asynchronous, I mean this is refreshing every time, it brings me data, but the problem is that I'm getting the data every time it is running.