get javascript url value

1

Hello, I would like you to help me, I am wanting to do a following validation in javascript. I explain, I'm realizing that I have data from a table where there is a field called State. and when the state is in process when you are pressed to see, I want that if the state says processed, a message or an alert is in process. If you could help me please

THIS IS THE TABLE THAT HAVE DATA.

because now when they give in to see is directed to another page but how could it do that when in state in PROCESS DO NOT REDIRECT AND EXIT THIS MESSAGE.

Script

<script>
      function getQueryVariable(variable) {
          console.log(variable);
          var proceso = variable;
          if(proceso=="3")
          {
              alert("prueba");
              return true;
          }

      }
  </script>

I put a console.log but in the variable that extracts the number 5 and I do not understand why it should grab the number 3 because in url idestadoincidencia says 3.

    
asked by PieroDev 22.10.2017 в 23:08
source

2 answers

1

You could add return :

<a href=DetalleSolucionIncidenciaUsuario.aspx?opt=1&IdIncidenci‌​a=1 onclick="return getQueryVariable(3)">Ver</a>

function getQueryVariable(variable) {
    console.log(variable);
    var proceso = variable;
    if(proceso=="3")
    {
        alert("prueba");
        return false;
    }
}
<a href=DetalleSolucionIncidenciaUsuario.aspx?opt=1&IdIncidenci‌​a=1 onclick="return getQueryVariable(3)">Ver Valor 3</a>
<a href=DetalleSolucionIncidenciaUsuario.aspx?opt=1&IdIncidenci‌​a=1 onclick="return getQueryVariable(4)">Ver Valor 4</a>
    
answered by 23.10.2017 / 02:26
source
0

Good morning, I do not know if this will be worth it. The alert you can put it, but with this system, duplicate sending is avoided, and therefore you avoid redirecting it. I hope I help you:

<DOCTYPE html>
    <html>

    <head>
        <meta charset="UTF-8">
        <title>evitar envio duplicado</title>
        <script type="text/javascript">
            function submit() {
                document.getElementById("submit").value = "enviando...";
               document.getElementById("submit").disabled = true;
                return true;
            }
        </script>

    </head>

    <body>
        <form id="formulario" action="#"> <!-- el asterisco le sustituimos por la URL a mandar formulario*/-->

            <input type="button" value="Enviar" onclick="this.disabled=true; this.value='enviando ...'" /> <!--añadiendo this.form.submit enviamos el formulario-->
        </form>


    </body>

    </html>

Greetings

    
answered by 23.10.2017 в 00:18