Information Is Not Loaded in MODAL Edit After Paging

Asked

Viewed 67 times

1

Good morning Galera,

I’m having a question and I was wondering if you could help me...

In this first img, I have a table made with data table with a list of entries, and each of them has the option to edit and delete. inserir a descrição da imagem aqui

After I click the edit button it brings the information of the same. inserir a descrição da imagem aqui

So far so good.

Then we go to another page As you can see all right too. inserir a descrição da imagem aqui

But after clicking edit on this other page the data is not loaded ! I would like to know why this happens ?

It seems to me that after I move to another page he misses the events, I do not know Rsrs I’d like some help ;-) inserir a descrição da imagem aqui

Most Grateful.

  • If you put in your code it helps a lot because there are several possible errors - https://answall.com/help/mcve. Something else, if you press F12 in your browser, Javascript errors will appear in the Console tab.

  • Yes, F12 and then check the Console tab for javascript errors. In addition, the code that is executed to display this modal, and how/where it will fetch the data will help to locate the problem(s)).

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>
  • 1

    Thanks for your help, but in my case it would be in c#

Browser other questions tagged

You are not signed in. Login or sign up in order to post.