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;
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:
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
add a comment |
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:
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
add a comment |
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:
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
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:
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
javascript php laravel-5 fullcalendar
edited Mar 24 at 20:24
halfer
14.9k759121
14.9k759121
asked Mar 24 at 8:57
Eem JeeEem Jee
311418
311418
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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);
Should the event title column should betitle
as well as the start? For now I havename
as the event title and the start isevent_date
(date time data type).
– Eem Jee
Mar 24 at 9:22
I change the url tourl: '/events',
and the result isError: 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 dourl: '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
Tryhttp://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
|
show 3 more comments
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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);
Should the event title column should betitle
as well as the start? For now I havename
as the event title and the start isevent_date
(date time data type).
– Eem Jee
Mar 24 at 9:22
I change the url tourl: '/events',
and the result isError: 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 dourl: '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
Tryhttp://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
|
show 3 more comments
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);
Should the event title column should betitle
as well as the start? For now I havename
as the event title and the start isevent_date
(date time data type).
– Eem Jee
Mar 24 at 9:22
I change the url tourl: '/events',
and the result isError: 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 dourl: '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
Tryhttp://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
|
show 3 more comments
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);
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);
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 betitle
as well as the start? For now I havename
as the event title and the start isevent_date
(date time data type).
– Eem Jee
Mar 24 at 9:22
I change the url tourl: '/events',
and the result isError: 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 dourl: '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
Tryhttp://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
|
show 3 more comments
Should the event title column should betitle
as well as the start? For now I havename
as the event title and the start isevent_date
(date time data type).
– Eem Jee
Mar 24 at 9:22
I change the url tourl: '/events',
and the result isError: 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 dourl: '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
Tryhttp://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
|
show 3 more comments
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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