Issues with fullcalendar refetchEvents and rerenderEvents in Safari and Opera browsers

After saving a dialog when creating a new event by clicking the day, I use the following code:

addEvent(calEvent); // save to database when creating an event 

$dialogContent.dialog("close");                            

$('#calendar').fullCalendar('removeEventSource', source1);
$('#calendar').fullCalendar('removeEventSource', source2);
$('#calendar').fullCalendar('removeEventSource', source3);
$('#calendar').fullCalendar('removeEvents'); // to prevent duplicate events

var source1 =  
    {
        url: '/admin_schedule/get_schedule_db/',
    };
var source2 =  {
        url: '/admin_schedule/get_schedule_db_recurring_events/',
        backgroundColor: 'green',
    };
var source3 =  {
        url: '/admin_schedule/get_schedule_db_recurring_events_on_daysweek/',
        backgroundColor: 'red',
    }; 

$('#calendar').fullCalendar('addEventSource', source1);
$('#calendar').fullCalendar('addEventSource', source2);
$('#calendar').fullCalendar('addEventSource', source3);
$calendar.fullCalendar('updateEvent', calEvent);   
$calendar.fullCalendar('rerenderEvents');                                                          
$('#calendar').fullCalendar('refetchEvents');

However, this does not refresh calendar events in Safari and Opera browsers. It works fine in Chrome and Firefox. What could be causing these issues?

Answer №1

To trigger an update of events in the calendar, simply invoke the refetchEvents function within the addEvent() method.

Therefore, within the save dialog box, include the following code snippet:

addEvent(calEvent); // Save event to database upon creation
    $dialogContent.dialog("close");

Additionally, append the following line inside the addEvent function: $('#calendar').fullCalendar('refetchEvents');

function addEvent(calEvent) { 
    var start = $.fullCalendar.formatDate(calEvent.start, "yyyy-MM-dd HH:mm");
    var end = $.fullCalendar.formatDate(calEvent.end, "yyyy-MM-dd HH:mm");
    var recurring_start = $.fullCalendar.formatDate(calEvent.recurring_start, "yyyy-MM-dd");
    var recurring_end = $.fullCalendar.formatDate(calEvent.recurring_end, "yyyy-MM-dd");

    var dataString = 'title='+calEvent.title+'&start='+start+'&end='+end+'&recurring_start='+recurring_start+'&recurring_end='+recurring_end+'&frequency_as_day='+calEvent.frequency_as_day+'&body='+calEvent.body+'&teacher_id='+calEvent.teacher_id;
    dataString = dataString + calEvent.days;
    $.ajax({
        type:"POST",
        url:"<?=base_url().'admin_schedule/add_schedule/'?>",
        data: dataString,
        success:function(html){ 
            $('#calendar').fullCalendar('refetchEvents'); 
        }
    });
    return false;
}    

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to develop a JavaScript function that divides the total width by the number of table headers (`th`)?

I recently came across this amazing scrollable table on a website, but I'm facing an issue with resizing the headers equally. Due to my lack of knowledge in JavaScript, I'm uncertain about how to tackle this problem. My intuition tells me that a ...

Alter the div's HTML content once the Ajax operation is completed

I have a div element that looks like this: <div class="progress" id="progress-bar"></div> I am using the following JavaScript code along with an ajax call to retrieve some data. The data returned is 0, however, the content is not being added ...

Which HTML element does each script correspond to?

Are there any methods to identify the script used in certain HTML elements? For instance, if I wish to determine the script responsible for creating a drop-down menu, I can locate the HTML and CSS for the menu but not the JavaScript (or other scripts). I ...

Shine a light on the input with a captivating outer

Can we replicate the outer glow effect that Safari and other browsers automatically add to an input field without using jQuery? If you want to remove it, check out this article: Thank you! ...

Adding external JavaScript files that rely on jQuery to a ReactJS project

As a beginner in web development, I have a question regarding importing external JavaScript files in ReactJS. I currently have the following imports: import $ from 'jquery'; window.jQuery = $; window.$ = $; global.jQuery = $; import './asse ...

Crop box overlaying video background

Utilizing jCrop to establish a crop region for a video element. My goal is to make the video section within the crop area fill a container with identical proportions, but I'm encountering challenges with the mathematical calculations. The sizes of th ...

What is the optimal approach to composing this? [jQuery - Top Recommendations - if statement]

SharePoint 2013 is the platform I am currently working on, and within it, there are some (.aspx) pages with specific titles. I have developed a script that examines the title of the current page. If it matches any of the predetermined query titles, then i ...

The occurrence of an unforeseen symbol 'a' was encountered

After using jQuery to create JSON data, the following structure was produced: [{"name":"date","value":"24-05-2013"},{"name":"omschrijving","value":""}] Although this JSON is valid, I encountered an error when trying to process it with jQuery: An unexp ...

Hover over the hidden DIV

I have a div containing an image that is overlapping multiple other divs. It looks something like this: <div style='width:100%;height:100%'><img src='someImage.png'></div> <div id='covered'>I'm un ...

What is the method to convert Javascript values from pixels to percentages?

Is it possible to change the scrolltop value dynamically based on a percentage of the user's screen size? I've been trying to achieve this using JS but haven't had any luck. Here is a link to a codepen that showcases the issue: [link] (http ...

Encounter a snag while using Chrome to access an external API through jQuery

I am currently utilizing jQuery to make a request to an external API via AJAX. $.ajax({ url: https://exampleAPI, method: "GET", contentType: "text/plain", dataType: "jso ...

Ways to Achieve the Following with JavaScript, Cascading Style Sheets, and Hypertext

Can someone help me convert this image into HTML/CSS code? I'm completely lost on how to do this and don't even know where to start searching for answers. Any assistance would be greatly appreciated. Thank you in advance. ...

Ensure Your Forms Are Error-Free with Jquery Form Validation

Currently working on a registration form that involves the use of credit cards. I have reached the stage of form validation to ensure that users input correct data in the appropriate fields. However, this has led me to ponder whether relying on JQuery for ...

Exploring the world of jQuery AJAX alongside Google's currency calculator

I'm currently working on a code that utilizes an AJAX call to access the Google currency calculator. The expected outcome is to receive a JSON array that can then be used to gather exchange rate data. Here is the link: http://www.google.com/ig/cal ...

JQuery is unable to initiate a keyup event

I am currently utilizing jQuery in a web application. On one of my pages, I have set up an event listener for keypresses as shown below: document.addEventListener('keyup', function (event) { event.preventDefault(); var key = event.k ...

How to use jQuery to locate and update the final parameter of a URL

Hello everyone, I've already done some research but couldn't find a solution that fits my needs. Can anyone assist me with this? I currently have a URL "/view/album/4/photo/1" and I am looking to remove the final parameter and replace it with so ...

Ways to prevent the jQuery simple slider from transitioning slides while it is in an invisible state

There is a jQuery slider on my website that behaves strangely when I navigate away from the Chrome browser and return later. It seems to speed through all pending slides quickly when it was not visible. Now, I want the slider to pause when it becomes invi ...

Caution: The `id` property did not match. Server: "fc-dom-171" Client: "fc-dom-2" while utilizing FullCalendar in a Next.js environment

Issue Background In my current project, I am utilizing FullCalendar v5.11.0, NextJS v12.0.7, React v17.0.2, and Typescript v4.3.5. To set up a basic calendar based on the FullCalendar documentation, I created a component called Calendar. Inside this comp ...

Using checkboxes to select all in AngularJS

Recently, I started working with Angularjs and came across some legacy code. I am trying to figure out a way to select all checkboxes once the parent checkbox is selected. Here is the parent checkbox: <div class="form-group"> <label for="test ...

Is Ajax a potential security risk in PHP applications?

I developed a PHP system with a page named x.php. On this page, I have created a variable called $accountid and retrieved the account ID from the session. There are other variables in PHP on the same page that call functions from another page named functi ...