JavaScript - como Condicionar mi Codigo SI mi stored Me regresa dos msj distintos

 
Vista:
sin imagen de perfil
Val: 22
Ha aumentado su posición en 3 puestos en JavaScript (en relación al último mes)
Gráfica de JavaScript

como Condicionar mi Codigo SI mi stored Me regresa dos msj distintos

Publicado por alexis (11 intervenciones) el 15/07/2019 20:53:21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function CambiarNumero() {
 
    var Skid1 = $("#Skid1").val();
    var Skid2 = $("#Skid2").val();
    var input = document.getElementById('Skid1');
    var input = document.getElementById('Skid2');
 
 
    callAjaxthree(Skid1, Skid2);
 
};
 
 
function callAjaxthree(Skid1, Skid2) {
 
    $.ajax({
        type: "POST",
        url: "/App/ButtonSkidjson",
        data: JSON.stringify({ 'Skid1': Skid1, 'Skid2': Skid2 }),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {
            tablethree(response);
 
            if (response != -1) {
            console.log(response);
 
 
            if (response == 1)
                return true;
 
            else {
 
                swal("¡Cambio Exitoso!", response, "error");
                return false;
            }
 
 
 
 
        } else {
            console.log("No Se Guardo La Operacion");
        }
    },
        failure: function (response) {
            console.log(response.responseText);
        },
        error: function (response) {
            console.log(response.responseText);
        }
    });
 
 
 
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Alejandro
Val: 1.448
Plata
Ha mantenido su posición en JavaScript (en relación al último mes)
Gráfica de JavaScript

como Condicionar mi Codigo SI mi stored Me regresa dos msj distintos

Publicado por Alejandro (532 intervenciones) el 16/07/2019 16:11:10
  • Alejandro se encuentra ahora conectado en el
  • chat de PHP
Si solo son 2 mensajes posibles es un simple if .. else
1
2
3
4
5
if(mensaje==1){
   alert('Mensaje 1');
}else{
   alert('Mensaje 2');
}

o con el operador ternario
1
alert( mensaje==1?'Mensaje 1':'Mensaje 2');

Si no estas seguro que solo sean 2, con if.. else if o switch
1
2
3
4
5
6
7
if(mensaje==1){
   alert('Mensaje 1');
}else if(mensaje==2){
   alert('Mensaje 2');
}else{
   alert('Cualquier otro distinto a 1 y 2');
}

1
2
3
4
5
6
7
8
9
10
switch(mensaje){
   case 1:
      alert('Mensaje 1');
      break;
   case 2:
      alert('Mensaje 2');
      break;
   default:
         alert('Cualquier otro distinto a 1 y 2');
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar