Highlight date if it has an event using fullCalendarEvent binding on dynamically created elements?Compare two dates with JavaScriptDetecting an “invalid date” Date instance in JavaScriptHow do I get the current date in JavaScript?How to format a JavaScript dateJavascript date conversion, sorting and displayfullcalendar parsing ISO8601 Date does not workMultiple FullCalendars on one pageCompare two events in fullcalendarFullcalendar not showing even in agendaDay if the event date is not matched with my computers date

Where did the “Vikings wear helmets with horn” stereotype come from and why?

Terminology about G- simplicial complexes

How can I find where certain bash function is defined?

Smart people send dumb people to a new planet on a space craft that crashes into a body of water

I think I may have violated academic integrity last year - what should I do?

Different PCB color ( is it different material? )

Were pen cap holes designed to prevent death by suffocation if swallowed?

What's the connection between "kicking a pigeon" and "how a bill becomes a law"?

What does the term “mohel” mean in Hilchot Melicha (salting)?

File globbing pattern, !(*example), behaves differently in bash script than it does in bash shell

NL - iterating all edges of a graph in log space

Future enhancements for the finite element method

Is there an explanation for Austria's Freedom Party virtually retaining its vote share despite recent scandal?

Glitch in AC sine wave interfering with phase cut dimming

What is the 中 in ダウンロード中?

Scaffoldings in New York

If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?

What problems does SciDraw still solve?

How did early x86 BIOS programmers manage to program full blown TUIs given very few bytes of ROM/EPROM?

Why do Russians call their women expensive ("дорогая")?

Do firearms count as ranged weapons?

How were these pictures of spacecraft wind tunnel testing taken?

Is there any use case for the bottom type as a function parameter type?

How do I subvert the tropes of a train heist?



Highlight date if it has an event using fullCalendar


Event binding on dynamically created elements?Compare two dates with JavaScriptDetecting an “invalid date” Date instance in JavaScriptHow do I get the current date in JavaScript?How to format a JavaScript dateJavascript date conversion, sorting and displayfullcalendar parsing ISO8601 Date does not workMultiple FullCalendars on one pageCompare two events in fullcalendarFullcalendar not showing even in agendaDay if the event date is not matched with my computers date






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I am trying to fetch all events in my db and highlight the dates that has an event in my UI. For now, I can only do it using static data and in my test code, it display the event name which what I want is to just highlight the date without displaying event name, how can I fetch I achieve it?



 $('#calendars').fullCalendar(

height: 395,

header:
// title, prev, next, prevYear, nextYear, today
left: 'prev',
center: 'title',
right: 'next'
,
events: [

title : 'event1',
start : '2019-03-01'
,

title : 'event2',
start : '2019-03-05',
,

title : 'event3',
start : '2019-03-15'
,

title : 'event5',
start : '2019-05-15'


],
eventRender: function (event, element, view)
// like that
var dateString = moment(event.start).format('YYYY-MM-DD');
$('#calendar').find('.fc-day-number[data-date="' + dateString + '"]').css('background-color', '#FAA732');
,
);


And the result for this one is like this:



enter image description here



I am planning to use ajax like:



events: [
$.ajax(
type: 'GET',
url: '/events',
success: function(events)
//return the result as the events data.


);
],


but I don't know how to implement it. This is my eventController;



 public function allEvents()
$events = Events::whereNotNull('event_date')->get();

return $events;



How can I possibly achieve my goal?










share|improve this question






























    1















    I am trying to fetch all events in my db and highlight the dates that has an event in my UI. For now, I can only do it using static data and in my test code, it display the event name which what I want is to just highlight the date without displaying event name, how can I fetch I achieve it?



     $('#calendars').fullCalendar(

    height: 395,

    header:
    // title, prev, next, prevYear, nextYear, today
    left: 'prev',
    center: 'title',
    right: 'next'
    ,
    events: [

    title : 'event1',
    start : '2019-03-01'
    ,

    title : 'event2',
    start : '2019-03-05',
    ,

    title : 'event3',
    start : '2019-03-15'
    ,

    title : 'event5',
    start : '2019-05-15'


    ],
    eventRender: function (event, element, view)
    // like that
    var dateString = moment(event.start).format('YYYY-MM-DD');
    $('#calendar').find('.fc-day-number[data-date="' + dateString + '"]').css('background-color', '#FAA732');
    ,
    );


    And the result for this one is like this:



    enter image description here



    I am planning to use ajax like:



    events: [
    $.ajax(
    type: 'GET',
    url: '/events',
    success: function(events)
    //return the result as the events data.


    );
    ],


    but I don't know how to implement it. This is my eventController;



     public function allEvents()
    $events = Events::whereNotNull('event_date')->get();

    return $events;



    How can I possibly achieve my goal?










    share|improve this question


























      1












      1








      1








      I am trying to fetch all events in my db and highlight the dates that has an event in my UI. For now, I can only do it using static data and in my test code, it display the event name which what I want is to just highlight the date without displaying event name, how can I fetch I achieve it?



       $('#calendars').fullCalendar(

      height: 395,

      header:
      // title, prev, next, prevYear, nextYear, today
      left: 'prev',
      center: 'title',
      right: 'next'
      ,
      events: [

      title : 'event1',
      start : '2019-03-01'
      ,

      title : 'event2',
      start : '2019-03-05',
      ,

      title : 'event3',
      start : '2019-03-15'
      ,

      title : 'event5',
      start : '2019-05-15'


      ],
      eventRender: function (event, element, view)
      // like that
      var dateString = moment(event.start).format('YYYY-MM-DD');
      $('#calendar').find('.fc-day-number[data-date="' + dateString + '"]').css('background-color', '#FAA732');
      ,
      );


      And the result for this one is like this:



      enter image description here



      I am planning to use ajax like:



      events: [
      $.ajax(
      type: 'GET',
      url: '/events',
      success: function(events)
      //return the result as the events data.


      );
      ],


      but I don't know how to implement it. This is my eventController;



       public function allEvents()
      $events = Events::whereNotNull('event_date')->get();

      return $events;



      How can I possibly achieve my goal?










      share|improve this question
















      I am trying to fetch all events in my db and highlight the dates that has an event in my UI. For now, I can only do it using static data and in my test code, it display the event name which what I want is to just highlight the date without displaying event name, how can I fetch I achieve it?



       $('#calendars').fullCalendar(

      height: 395,

      header:
      // title, prev, next, prevYear, nextYear, today
      left: 'prev',
      center: 'title',
      right: 'next'
      ,
      events: [

      title : 'event1',
      start : '2019-03-01'
      ,

      title : 'event2',
      start : '2019-03-05',
      ,

      title : 'event3',
      start : '2019-03-15'
      ,

      title : 'event5',
      start : '2019-05-15'


      ],
      eventRender: function (event, element, view)
      // like that
      var dateString = moment(event.start).format('YYYY-MM-DD');
      $('#calendar').find('.fc-day-number[data-date="' + dateString + '"]').css('background-color', '#FAA732');
      ,
      );


      And the result for this one is like this:



      enter image description here



      I am planning to use ajax like:



      events: [
      $.ajax(
      type: 'GET',
      url: '/events',
      success: function(events)
      //return the result as the events data.


      );
      ],


      but I don't know how to implement it. This is my eventController;



       public function allEvents()
      $events = Events::whereNotNull('event_date')->get();

      return $events;



      How can I possibly achieve my goal?







      javascript php laravel-5 fullcalendar






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 at 20:24









      halfer

      14.9k759121




      14.9k759121










      asked Mar 24 at 8:57









      Eem JeeEem Jee

      311418




      311418






















          1 Answer
          1






          active

          oldest

          votes


















          2














          You can try something like this:



          events: function(start, end, timezone, callback) 
          $.ajax(
          url: "http://yourwebsite.com/events", // complete URL here.. you need to change it
          dataType: "json",
          type: 'GET',
          success: function(data)
          callback(data);
          ,
          error: function(error)
          console.log("Error:");
          console.log(error);

          )



          and change controller code to return JSON



          public function allEvents()
          $events = Events::whereNotNull('event_date')->get();
          // make sure events data has title and start values returned from the database.
          return response()->json($events);






          share|improve this answer

























          • Should the event title column should be title as well as the start? For now I have name as the event title and the start is event_date (date time data type).

            – Eem Jee
            Mar 24 at 9:22











          • I change the url to url: '/events', and the result is Error: calendar.js:33 readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …

            – Eem Jee
            Mar 24 at 9:23











          • You need to use a complete URL there.. a public URL.

            – Satish Saini
            Mar 24 at 9:24











          • I tried to do url: 'localhost/events' but it returns GET localhost/localhost/events 404 (Not Found)`. Because for now I'm developing in my local.

            – Eem Jee
            Mar 24 at 9:27











          • Try http://localhost/events if this is giving you the events data in return.. OR open the events page in a brower window where you can see events JSON data returned and copy that URL here in AJAX request.

            – Satish Saini
            Mar 24 at 9:28











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55322138%2fhighlight-date-if-it-has-an-event-using-fullcalendar%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          You can try something like this:



          events: function(start, end, timezone, callback) 
          $.ajax(
          url: "http://yourwebsite.com/events", // complete URL here.. you need to change it
          dataType: "json",
          type: 'GET',
          success: function(data)
          callback(data);
          ,
          error: function(error)
          console.log("Error:");
          console.log(error);

          )



          and change controller code to return JSON



          public function allEvents()
          $events = Events::whereNotNull('event_date')->get();
          // make sure events data has title and start values returned from the database.
          return response()->json($events);






          share|improve this answer

























          • Should the event title column should be title as well as the start? For now I have name as the event title and the start is event_date (date time data type).

            – Eem Jee
            Mar 24 at 9:22











          • I change the url to url: '/events', and the result is Error: calendar.js:33 readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …

            – Eem Jee
            Mar 24 at 9:23











          • You need to use a complete URL there.. a public URL.

            – Satish Saini
            Mar 24 at 9:24











          • I tried to do url: 'localhost/events' but it returns GET localhost/localhost/events 404 (Not Found)`. Because for now I'm developing in my local.

            – Eem Jee
            Mar 24 at 9:27











          • Try http://localhost/events if this is giving you the events data in return.. OR open the events page in a brower window where you can see events JSON data returned and copy that URL here in AJAX request.

            – Satish Saini
            Mar 24 at 9:28















          2














          You can try something like this:



          events: function(start, end, timezone, callback) 
          $.ajax(
          url: "http://yourwebsite.com/events", // complete URL here.. you need to change it
          dataType: "json",
          type: 'GET',
          success: function(data)
          callback(data);
          ,
          error: function(error)
          console.log("Error:");
          console.log(error);

          )



          and change controller code to return JSON



          public function allEvents()
          $events = Events::whereNotNull('event_date')->get();
          // make sure events data has title and start values returned from the database.
          return response()->json($events);






          share|improve this answer

























          • Should the event title column should be title as well as the start? For now I have name as the event title and the start is event_date (date time data type).

            – Eem Jee
            Mar 24 at 9:22











          • I change the url to url: '/events', and the result is Error: calendar.js:33 readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …

            – Eem Jee
            Mar 24 at 9:23











          • You need to use a complete URL there.. a public URL.

            – Satish Saini
            Mar 24 at 9:24











          • I tried to do url: 'localhost/events' but it returns GET localhost/localhost/events 404 (Not Found)`. Because for now I'm developing in my local.

            – Eem Jee
            Mar 24 at 9:27











          • Try http://localhost/events if this is giving you the events data in return.. OR open the events page in a brower window where you can see events JSON data returned and copy that URL here in AJAX request.

            – Satish Saini
            Mar 24 at 9:28













          2












          2








          2







          You can try something like this:



          events: function(start, end, timezone, callback) 
          $.ajax(
          url: "http://yourwebsite.com/events", // complete URL here.. you need to change it
          dataType: "json",
          type: 'GET',
          success: function(data)
          callback(data);
          ,
          error: function(error)
          console.log("Error:");
          console.log(error);

          )



          and change controller code to return JSON



          public function allEvents()
          $events = Events::whereNotNull('event_date')->get();
          // make sure events data has title and start values returned from the database.
          return response()->json($events);






          share|improve this answer















          You can try something like this:



          events: function(start, end, timezone, callback) 
          $.ajax(
          url: "http://yourwebsite.com/events", // complete URL here.. you need to change it
          dataType: "json",
          type: 'GET',
          success: function(data)
          callback(data);
          ,
          error: function(error)
          console.log("Error:");
          console.log(error);

          )



          and change controller code to return JSON



          public function allEvents()
          $events = Events::whereNotNull('event_date')->get();
          // make sure events data has title and start values returned from the database.
          return response()->json($events);







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 24 at 10:33

























          answered Mar 24 at 9:17









          Satish SainiSatish Saini

          1,80921529




          1,80921529












          • Should the event title column should be title as well as the start? For now I have name as the event title and the start is event_date (date time data type).

            – Eem Jee
            Mar 24 at 9:22











          • I change the url to url: '/events', and the result is Error: calendar.js:33 readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …

            – Eem Jee
            Mar 24 at 9:23











          • You need to use a complete URL there.. a public URL.

            – Satish Saini
            Mar 24 at 9:24











          • I tried to do url: 'localhost/events' but it returns GET localhost/localhost/events 404 (Not Found)`. Because for now I'm developing in my local.

            – Eem Jee
            Mar 24 at 9:27











          • Try http://localhost/events if this is giving you the events data in return.. OR open the events page in a brower window where you can see events JSON data returned and copy that URL here in AJAX request.

            – Satish Saini
            Mar 24 at 9:28

















          • Should the event title column should be title as well as the start? For now I have name as the event title and the start is event_date (date time data type).

            – Eem Jee
            Mar 24 at 9:22











          • I change the url to url: '/events', and the result is Error: calendar.js:33 readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …

            – Eem Jee
            Mar 24 at 9:23











          • You need to use a complete URL there.. a public URL.

            – Satish Saini
            Mar 24 at 9:24











          • I tried to do url: 'localhost/events' but it returns GET localhost/localhost/events 404 (Not Found)`. Because for now I'm developing in my local.

            – Eem Jee
            Mar 24 at 9:27











          • Try http://localhost/events if this is giving you the events data in return.. OR open the events page in a brower window where you can see events JSON data returned and copy that URL here in AJAX request.

            – Satish Saini
            Mar 24 at 9:28
















          Should the event title column should be title as well as the start? For now I have name as the event title and the start is event_date (date time data type).

          – Eem Jee
          Mar 24 at 9:22





          Should the event title column should be title as well as the start? For now I have name as the event title and the start is event_date (date time data type).

          – Eem Jee
          Mar 24 at 9:22













          I change the url to url: '/events', and the result is Error: calendar.js:33 readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …

          – Eem Jee
          Mar 24 at 9:23





          I change the url to url: '/events', and the result is Error: calendar.js:33 readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …

          – Eem Jee
          Mar 24 at 9:23













          You need to use a complete URL there.. a public URL.

          – Satish Saini
          Mar 24 at 9:24





          You need to use a complete URL there.. a public URL.

          – Satish Saini
          Mar 24 at 9:24













          I tried to do url: 'localhost/events' but it returns GET localhost/localhost/events 404 (Not Found)`. Because for now I'm developing in my local.

          – Eem Jee
          Mar 24 at 9:27





          I tried to do url: 'localhost/events' but it returns GET localhost/localhost/events 404 (Not Found)`. Because for now I'm developing in my local.

          – Eem Jee
          Mar 24 at 9:27













          Try http://localhost/events if this is giving you the events data in return.. OR open the events page in a brower window where you can see events JSON data returned and copy that URL here in AJAX request.

          – Satish Saini
          Mar 24 at 9:28





          Try http://localhost/events if this is giving you the events data in return.. OR open the events page in a brower window where you can see events JSON data returned and copy that URL here in AJAX request.

          – Satish Saini
          Mar 24 at 9:28



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55322138%2fhighlight-date-if-it-has-an-event-using-fullcalendar%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript