1
I have the following code in javascript and ajax:
function marcar_consulta(id_paciente,id_horario, data_consulta )
    {
        $.ajax
        ({
            type:'post',
            url:'insert_consulta.php',
            data:{marcar_consulta:'marcar_consulta', pid_paciente:id_paciente, pid_horario:id_horario , pdata_consulta:data_consulta,},
            success:function(response) 
            {
                if(response=="success")
                {
                    window.alert('Inserido com SUCESSO');
                }
                else  
                {   
                    window.alert(response);         
                }
            }
        });
    }
and in INSERT_CONSULTA.PHP I have the following code..:
<?php
    $user = "maria";
    $pass = "1111";
    $host = "192.168.25.4";
    $banco = "base";
    $conexao = mysql_connect($host, $user, $pass) or die(mysql_error());
    mysql_select_db($banco);
    mysql_query("SET NAMES 'utf8'");
    mysql_query('SET character_set_connection=utf8');
    mysql_query('SET character_set_client=utf8');
    mysql_query('SET character_set_results=utf8');
    if(isset($_POST['marcar_consulta']))
    {
        $pid_paciente=$_POST['pid_paciente'];
        $pid_horario=$_POST['pid_horario'];
        $pdata_consulta = $_POST['pdata_consulta']; 
        $sql =  " Insert into consulta " .          
                " ( id_paciente_fk, id_m_h_fk,  id_convenio_fk, data_consulta)" .
                " values " .
                " ( ".$pid_paciente.",".$pid_horario.", 0,'" .$pdata_consulta. "')";
        $resultado = mysql_query($sql, $conexao) or die(mysql_error()); 
        echo "success";
        mysql_close($conexao); 
    }
?>
Everything works wonders :), however, there are times when I press the button that triggers the function dial_query and the Insert takes time.
Is there any procedure or something that informs the user that the
button not yet finished.. Type a cursor... Because of my lack of experience with php I really don’t know how ,what to look for or how to google this problem..
Where Java Comes In?
– user28595
@Article Sorry.. At the time appeared the autocomplete... I must have clicked wrong.. javascript
– Ricardo M.Souza