lundi 11 mars 2019

send data jQuery to laravel controller countdown used

i'm using laravel and i want to receive data from jQuery to my controller to insert it to array or collection , i tried many methodes but without success this is my script : (When "#offre-status-" + targetElementId== 00day00h00m )

$(document).ready(function () {
    @foreach ($display as $sends)
        @foreach($sends->offreManagers as $offreManager)
            countDown("", "", "");
        @endforeach
    @endforeach


    function countDown(targetElementId, date, now) {
        var countDownDate = date * 1000;
        var now = now * 1000;
        var x = setInterval(function() {
            now = now + 1000;
            var distance = countDownDate - now;
            var days = Math.floor(distance / (1000 * 60 * 60 * 24));
            var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
            var seconds = Math.floor((distance % (1000 * 60)) / 1000);
            $('#count-down-item-' + targetElementId).html(days + "d " + hours + "h " + minutes + "m " + seconds + "s ");
            if (distance < 0) {
                clearInterval(x);
                $("#offre-status-" + targetElementId).removeClass("bg-green");
                $("#offre-status-" + targetElementId).addClass("bg-red");
                $("#count-down-item-" + targetElementId).html("SENT");
            } else {
                $("#offre-status-" + targetElementId).removeClass("bg-red");
                $("#offre-status-" + targetElementId).addClass("bg-green");
            }
        }, 1000);
    }
});

Method when i want to put values in collection :

 public function getFullSendCollection()
   {
       return CollectionValues;
   }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire