jeudi 21 novembre 2019

run public function in script function and not on load laravel fullcalendar

i am trying to run a public function whenever a js function is executed in laravel

here is my code:

select: function(info) {
  var title = prompt('Event Title:');

  calendar.addEvent({
          title: title,
          start: info.startStr,
          end: info.endStr,
          allDay: false
        });

            var start = info.startStr;
            var end = info.endStr;

            $title = title;
            $start = start;
            $end = end;
            $verified = 0;


            <?php echo \App\Http\Controllers\FullCalendarController::create();?>



        calendar.unselect();

},

i want to specificaly run <?php echo \App\Http\Controllers\FullCalendarController::create();?> whenever the function is called but it always runs on load.

it does not work specificaly because the variables that the function uses ($title, $start, $end) are not defined until the function runs.

i have tried putting a laravel if statement around it but then it dosn't work at all and a js if statement runs it on load anyway.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire