Run function.php with confirm boostbox.js

0

I have a database.php file where I have the following functions:

class Conexao(){

    function Conexao(){}

    function Inserir(){}

    function Update(){}

    function select(){}

    function edit(){}

}

I have a pagina.php where I list the database data in PDO , in this página.php I have the edit , update , del and insert .

I have a script.js which when I click the edit button calls me a modal.js where I have the following code:

<script>
    //Confirm Advanced Usage
    $("#del").click(function(){
    bootbox.confirm({
    size: "small",
        message:"Deseja mesmo deletar este Registro?",
        buttons:{
            confirm:{
            label:'Sim, desejo!',
            className:'btn-success'
            },
            cancel:{
                    label:"Não desejo!",
                    className:'btn-danger'
                }
        },
        callback:function(result){
             console.log(response);
            }
    })
});

</script>

The above script uses confirm of bootbox.js

My question is how to make this button perform the delete function of

class Conexao(){

    function Conexao(){}

    function Inserir(){}

    function Update(){}

    function Select(){}

    /*executar está função abaixo*/

    function Deletar(){}

}

I can not get the function right inside the class.

    
asked by anonymous 22.02.2017 / 03:59

1 answer

0

First create a PHP page that instantiates the connection class. Implement the delete method. Defined a variable to get the Ajax data via POST and pass it as a parameter in this function.

Then create a javascript function to delete. In which you would receive a parameter for deletion. This function will pass this parameter to the ajax request, which will send the data to your previously created PHP page in which you implemented the connection class and the Delete method.

So just call this function in javascript for the confirm callback of your modal.

    
22.02.2017 / 12:47