The property 'clone' is undefined and cannot be read

Currently, I am using Fullcalendar to update events. My goal is to execute an ajax callback to retrieve the edited version of a specific event. The endpoint for this request should be at /controls/:id/edit. To achieve this functionality, I have implemented the following ajax callback:

eventClick: function(date, jsEvent, view) {
                console.log(date.id)
                console.log(jsEvent)
                console.log(view)
                 $.ajax({
                  type: "GET",
                  url: "/controls/"+date.id+"/edit",
                  });

            $('#calendar').fullCalendar('updateEvent', event);

}

The code snippet from controls_controller.rb looks like this:

def edit
    if request.xhr?
        @control = Control.find(params[:id])
    end

Upon clicking on an event, I encounter the error message in the console stating "Uncaught TypeError: Cannot read property 'clone' of undefined". This issue has been perplexing me as I believe my implementation is correct. Can anyone provide assistance in resolving this matter? Any help would be greatly appreciated. Thank you.

Answer №1

Kindly review the event data. The Source attribute of your event should either be null or not populated. Therefore, before executing the following code:

$('#calendar').fullCalendar('updateEvent', event);

It is crucial to ensure that all required attributes of your fullcalendar event are filled in. For more information on the mandatory and optional fields for the event object, please refer to the following link:

http://fullcalendar.io/docs/event_data/Event_Object/

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

Is there a way to access the value of a variable within a loop inside a function and store it in a global variable?

I am struggling to retrieve the value of a variable after it has passed through a loop. I attempted to make it a global variable, but its value remains unchanged. Is there any way to achieve this? Below is my code snippet where I am attempting to access t ...

Could anyone provide recommendations on how to globally declare jQuery in a Vue-CLI 3 project?

I've come across numerous inquiries on various platforms about this issue, but I have yet to find a solution. To provide some background, I constructed a single-page application website using Vue by initiating a project with an older command. Althoug ...

error: local server did not return any data

I am currently using PHP on a Linux machine. In my HTML code, I have set up an AJAX request to the local Apache server (check http://localhost), with the intention of displaying the data from the server on the screen. However, for some reason, nothing is b ...

Sending Emails with AngularJS

Exploring AngularJs has been a delightful experience for me, and I recently stumbled upon a fantastic plugin for Angular called angular-http-auth. This plugin allows you to seamlessly integrate an identification system. Does anyone know of a similar resou ...

What is the best way to receive a notification when a user chooses any option in a Material UI Autocomplete React component?

My dilemma involves using an autocomplete feature that doesn't behave as expected. I am looking to detect when an option is selected, regardless of whether it's the same as the last selection. The onChange event I'm using only triggers if th ...

Upgrade angular-chart.js when applied to a filtered collection

I recently started working with Angular and encountered an issue while incorporating Angular Charts JS. I have a list that can be filtered using search text, and I want my charts to update whenever the list is filtered. What would be the best approach to ...

Understanding the extent of variables in Javascript

I'm struggling to comprehend the scope of 'this' in this particular situation. I can easily call each of these functions like: this.startTracking(); from within the time tracker switch object. However, when attempting to execute the code: Dr ...

Guide to creating a delayed response that does not block in Node and Express

I want to implement a delayed response to the browser after 500ms has elapsed. app.post('/api/login', function(req, res) { setTimeout(function() { res.json({message: "Delayed for half a second"}); }, 500); }); The code snippet a ...

Adding Angular dependencies through Gulp (with the help of Browserify)

Exploring the use of Gulp and Browserify in my new Angular application. Inquiry: How can I effectively include angular dependencies in the app.js file without encountering dependency errors? Even with minimal dependencies, such as using only $stateProvid ...

Remove data from a database using Ajax in ASP.NET MVC without utilizing DataTables

I'm encountering a slight issue with my code. I am attempting to delete a row from the database without using DataTables in ASP.NET MVC, but it seems to be not working as expected. I have displayed all items from the database on a page within div elem ...

AngularUI Calendar event source which triggers a function with each change of view

In order to showcase the issue, let me explain my objective. I am in the process of developing a booking system using AngularUI Calendar. The problem arises when the calendar's performance noticeably deteriorates as the number of events increases (100 ...

I'm struggling to understand how to interpret this. The v-tab function seems to be generating a button with various properties, but I'm unsure which specific property is related to

The V-tab below generates the button known as the right one on the v-app-bar: https://i.stack.imgur.com/DzNmq.png <v-tab :to="'/demo'" active-class="text--primary" class=&quo ...

Steps to eliminate a specific value from an array

I need to remove values with the .html extension from an array in JavaScript, leaving only those items that do not have the .html extension. Here's my current code: main.js: var arr=["test1.html","power.html","main.html","save.md","kart.html","taste ...

The Rails application encountered an error when attempting to render a partial using ajax, as

I'm encountering an issue while implementing ajax for my comment form submission. When attempting to render a partial, I am faced with an error that I can't seem to resolve. The comments are being created successfully, but the problem arises when ...

Encountering a "DOM Exception 11: InvalidStateError" when attempting to use websocket.send

I encountered the following error message: DOM Invalidate exception 11 This error is coming from the code snippet below, but I'm having trouble identifying the root cause. /*The coding style may appear pseudo-stylish with potential syntax errors*/ ...

Contrast between utilizing a WebApp that connects to an API and one that relies on backend

Whenever I develop simple web applications, I often begin by setting up a nodeJS backend, usually creating an API server with ExpressJS. When specific routes are accessed, the server responds by dynamically rendering HTML from EJS based on the current conn ...

Create your own AngularJS directive for displaying or hiding elements using ng-show/ng

Caution: Angular rookie in action. I'm attempting to craft a personalized widget that initially displays a "Reply" link, and upon clicking it, should hide the link and reveal a textarea. Here's my current progress, but unfortunately, it's n ...

"Apply a class to a span element using the onClick event handler in JavaScript

After tirelessly searching for a solution, I came across some answers that didn't quite fit my needs. I have multiple <span id="same-id-for-all-spans"></span> elements, each containing an <img> element. Now, I want to create a print ...

"Troubleshooting an issue with ng-model not functioning properly with radio buttons in Angular

I'm a newcomer to Angular and I'm attempting to retrieve the value of the radio button selected by the user using ng-model. However, I'm not seeing any output in "selected contact". Check out My HTML below: <!doctype html> <html n ...

Alter the functionality of the input element that has a tag of 'multiple'

I am encountering an issue with a form that allows users to upload multiple photos. When selecting multiple files at once, everything works as expected. However, if a user wants to add images one by one, each new addition deletes the previous file due to t ...