-1

Is it possible to send output to email instead of

<div id="fullCalendar" ></div>

after a full night, surfing the web, i cant find the solution, i'm no jquery programmer, so i realy hope some one can point me in the right direction

   $(function() {
        'use strict';

        $('#fullCalendar').fullCalendar({
             locale: 'nl',
          defaultView: 'listWeek',
           events: 'admin_app/kalender_load.php',
           eventColor: '',
    selectable:true,
    selectHelper:true

        });
      });
      $.post("email.php", { data : $("div#fullCalendar").html() }, function(result){
  /* handle results */
});

I aspect to send the events from upcomming week true email, but all i get is an empty mail

ADyson
  • 57,178
  • 14
  • 51
  • 63
Steefman
  • 3
  • 1

1 Answers1

0

fullCalendar renders its content asynchronously - both the view and the events are rendered in separate asynchronous processes. You are trying to capture the content before it has been drawn (and in the case of the events, before the data has even been downloaded from your server).

You can use the viewRender callback to cause your code to wait until the calendar has been rendered.

Or if you need to include event data (which I guess you might) then you should use eventAfterAllRender instead, which waits until your events have been downloaded and drawn as well (this always occurs after the view has been rendered):

$(function() {
  'use strict';

  $('#fullCalendar').fullCalendar({
    locale: 'nl',
    defaultView: 'listWeek',
    events: 'admin_app/kalender_load.php',
    eventColor: '',
    selectable: true,
    selectHelper: true,
    eventAfterAllRender: function(view) {
      console.log($("div#fullCalendar").html())
      $.post("email.php", {
        data: $("div#fullCalendar").html()
      }, function(result) {
        /* handle results */
      });
    }
  });
});

Demo: http://jsfiddle.net/baqdx94e/2/

ADyson
  • 57,178
  • 14
  • 51
  • 63
  • Thanks a lot for your feedback. much appreciated. – Steefman Jun 26 '19 at 16:27
  • @Steefman no problem. If the answer helps you and/or fixes your problem, please remember to mark it as "accepted" by clicking the tick mark next to the answer so it turns green. This both indicates to other users reading this that the answer was useful, and it also rewards the asker with reputation points (thus encouraging others to answer your other questions in future). Thanks :-) – ADyson Jun 26 '19 at 16:29