javascript - Get data from jQuery Fullcalendar and pass it to controller -
i need value of id
of event chosen, when it's clicked. once dialog box open, have link redirect page. need pass eventid
controller use redirected page.
i can't seem resolve issue, got going week already.
here's script:
<script type='text/javascript'> $(document).ready(function(){ $('#calendar').fullcalendar({ header : { left: 'prev,next', center: 'title', right: 'month,agendaweek,agendaday' }, allday: false, events: "<?php echo site_url('home/calendarlist') ?>", eventclick: function(event, jsevent, view) { //set values , open modal $("#starttime").html(moment(event.start)); $("#starttime").html(moment(event.start).format('h:mm a')); $("#endtime").html(moment(event.start).add('hours',1).format('h:mm a')); $("#eventinfo").html(event.description); $("#eventissue").html(event.issue); $("#eventrefid").html(event.id); //i need pass value of //to controller , //which used in page //(no ajax needed if possible) $("#eventid").html(event.issue); $("#eventlink").attr('href', event.url); $("#eventcontent").dialog({ modal: true, title: event.title }); $(this).css('border-color', 'red'); } }); }); </script>
and here html code:
<section> <div class="content" id="eventcontent" title="event details" style="display:none;"> <?= form_open('home/accomplish_appointment');?> <span style="font-weight: bold;">from:</span> <span id="starttime"></span><br> <span style="font-weight: bold;">to: <span id="endtime"></span> <hr> <span style="font-weight: bold;">issue: <span id="eventissue"></span><br> <span style="font-weight: bold;">special instruction: <span id="eventinfo"></span><br><br> <button class="fr submit small" type="submit" id="eventlink">accomplish appointment</button> <?= form_close();?> </div> </section>
try pass eventid using code bellow. submits form sends eventid home/accomplish_appointment
:
in jquery code add assign event id hidden input of form:
$("#eventid").val($("#eventrefid").html(event.id));
and in html:
<?= form_open('home/accomplish_appointment');?> <input type="hidden" id="eventid" name="eventid" /> <span style="font-weight: bold;">from:</span> <span id="starttime"></span><br> <span style="font-weight: bold;">to: <span id="endtime"></span> <hr> <span style="font-weight: bold;">issue: <span id="eventissue"></span><br> <span style="font-weight: bold;">special instruction: <span id="eventinfo"></span><br><br> <button class="fr submit small" type="submit" id="eventlink">accomplish appointment</button> <?= form_close();?>
Comments
Post a Comment