Information is not loaded in MODAL Edit After Page

1

Good morning, people,

I have a question and would like to know if you could help me ...

In this first img, I have a table made with a data table with a list of entries, and each one of them has the option to edit and delete.

AfterIclicktheeditbuttonitbringstheinformationaboutit.

SofarsogoodOkay.

TherewegotoanotherpageHowcanyouseeallrighttoo.

Butafterclickingeditonthisotherpagethedataisnotloaded!Wouldyouliketoknowwhythishappens?

ItseemsthatafterImovetoanotherpageitlosestheevents,IdonotknowRsrsIwouldlikesomehelp;-)

Very grateful.

    
asked by anonymous 03.07.2018 / 15:29

1 answer

0

I think this will help you:

<?php
                           while ($mm = mysqli_fetch_assoc($result)){
                               echo '<tr>';
                               echo '<td>'.$mm['id_variavel'].'</td>';
                               echo '<td>
                               <button type="button" class="btn btn-primary">
                                   <a data-toggle="modal"
                                        data-target="#exampleModal"
                                        data-whatever="'.$mm['id_variavel'].' ">Atualizar</a>
                                    </button>
                                    </td>';
                                    echo '</tr>';
                                }
                                $result->close();
                            ?>

    <script>
            $('#exampleModal').on('show.bs.modal', function (event) {
                var button = $(event.relatedTarget) 
                var recipient = button.data('whatever') 
                var modal = $(this);
                var dataString = 'id=' + recipient;

                    $.ajax({
                        type: "GET",
                        url: "edit-modal.php", //para o ficheiro de criação do modal
                        data: dataString,
                        cache: false,
                        success: function (data) {
                            console.log(data);
                            modal.find('.dash').html(data);
                        },
                        error: function(err) {
                            console.log(err);
                        }
                    });
            })
        </script>
    
03.07.2018 / 17:10