mardi 22 octobre 2019

How to show newly inserted mysql data into laravel view automatically without refreshing the page?

I have a script that is showing same data again and again automatically.Here is my output-output But i want to show only newly inserted data with old data.Now can anyone please help me with that issue please ? i am providing my script bellow.

    <script type="text/javascript">
    $(document).ready(function () {
    var info = 0; //Set id to 0 so you will get all records on page load.
    var request = function () {
    $.ajax({
      type: 'get',
      url:'{!!URL::to("matchview")!!}',
      data: { id: info }, //Add request data
      dataType: 'json',
      success: function (data) {
        $.each(data, function () {
            $.each(this, function (index, value) {
                console.log(value);
            });
           });
         }, error: function () {
        console.log(data);
        }
      });
     };
     setInterval(request, 1000);
      });
    </script>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire