Take javascript id to php

0

I have the following problem, I have a modal in which I am going to show information from a database, which I achieved with this function:

function ver(id){

    $('.modal-body').load('php/CargarAlmacenamiento.php?id=12',function(){
        $('#modalAlmacenamiento').modal({show:true});
    });
}

but my fault is that I always load the same record (in this example the one with ID 12), I intend that the id be captured by the one that I have the modal button:

button class="btn btn-success glyphicon glyphicon-eye-open" data-toggle="modal" data-target="#modalAlmacenamiento" 
                             onclick="ver('?php echo $ver[0] ?>')"></button>

In the php part, the id of each record appears, but as mentioned above, it does not take it when taking it to the function.

Thanks for your cooperation.

    
asked by Leo Porras 26.04.2018 в 23:04
source

1 answer

2

You've already tried passing the id to the end of the url, something like this:

function ver(id){
    $('.modal-body').load('php/CargarAlmacenamiento.php?id='+id,function(){
        $('#modalAlmacenamiento').modal({show:true});
    });
}
    
answered by 26.04.2018 / 23:14
source