AJAX function with VUE

0

I would like to know in what way the following code can be done but with VUE, I would like to venture into this new technology but I do not have much knowledge about it then I would like to pass the next ajax call but with VUE, I have already loaded the library to project.

    <script>
   $("#del-"+<?php echo $persona["id"];?>).click(function(e){
        e.preventDefault();

    id = document.getElementById("id-"+<?php echo $persona["id"];?>).value//obtener valor del input


                                   var url = "enviar.php";
                                   $.ajax({
                                      type: "POST",
                                      url: url,
                                      data:{id:id},
                                      success: function(data)
                             {

                           }
                       });

                           });
    </script>
    
asked by juan perez 03.12.2018 в 17:29
source

1 answer

0

you can do it like this:

data="{'id','id'}";
//nombre del metodo
getPersona(url,data) {
// puede ser post o get
  this.$http.post(url,data).then((response) {
  this.message = response;
});
    
answered by 03.12.2018 в 17:38