mercredi 2 mars 2016

how to get values from db and insert them to events array

my code is as follows.

<?php $ta=array();$da=array();$i=0;?>
@foreach($events as $ev)
    <?php
    $ta[$i]=$ev->title;
    $da[$i]=$ev->eventDate;
    $i++;
    ?>

@endforeach

<script>
    var t=<?php echo json_encode($ta)?>;
    var d=<?php echo json_encode($da)?>;

$(document).ready(function() {


                $('#calendar').fullCalendar({

                    //defaultDate: '2016-03-12',
                    editable: true,
                    eventLimit: true, // allow "more" link when too many events


                    //$r=$ev->title;

                    for(var j=0;j<d.length;j++)
                    {


                        events: [{
                                title: t[j],
                                start: d[j]
                            }
                        ]


                    }



                });

    });

</script>

I have used the fullcalendar 2.6.1. But nothing displayed. Please can anybody help me? I want to retrieve all the title and eventDate from the db and view in the calendar. The var t and d contains the all the data of $ta and $da arrays. I just wanted to assign them to events array title and start keywords.There are some red marks indicate that for loop is going to be wrong.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1T7y22I
via IFTTT

Aucun commentaire:

Enregistrer un commentaire