当前位置: 首页 > 知识库问答 >
问题:

未捕获的TypeError:$(…).FullCalendar不是函数是我尝试将日历引入引导模板时出现的问题

山凌
2023-03-14

我想我可能加载错误的脚本,但我真的找不到问题。如果你有什么想法,将不胜感激。如果你有任何想法,请分享,因为我看了所有关于这个话题的帖子,我真的无法修复它

<?php
// Initialize the session
require_once "isconnected.php";
?>

<!DOCTYPE html>
<html lang="en">

<head>

 <link rel="stylesheet" href="assets/css/lib/fullcalendar/fullcalendar.min.css" />
 <script src="assets/js/lib/fullcalendar/lib/moment.min.js"></script>
 <script src="assets/js/lib/fullcalendar/lib/jquery.min.js"></script>
 <script src="assets/js/lib/fullcalendar/fullcalendar.min.js"></script>



 <script>

 $(document).ready(function () {
     var calendar = $('#calendar').fullCalendar({
         editable: true,
         events: "fetch-event.php",
         displayEventTime: false,
         eventRender: function (event, element, view) {
             if (event.allDay === 'true') {
                 event.allDay = true;
             } else {
                 event.allDay = false;
             }
         },
         selectable: true,
         selectHelper: true,
         select: function (start, end, allDay) {
             $("#myModal").modal();
             var title = prompt('Event Title:');

             if (title) {
                 var start = $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss");
                 var end = $.fullCalendar.formatDate(end, "Y-MM-DD HH:mm:ss");

                 $.ajax({
                     url: 'add-event.php',
                     data: 'title=' + title + '&start=' + start + '&end=' + end,
                     type: "POST",
                     success: function (data) {
                         displayMessage("Added Successfully");
                     }
                 });
                 calendar.fullCalendar('renderEvent',
                         {
                             title: title,
                             start: start,
                             end: end,
                             allDay: allDay
                         },
                 true
                         );
             }
             calendar.fullCalendar('unselect');
         },

         editable: true,
         eventDrop: function (event, delta) {
                     var start = $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
                     var end = $.fullCalendar.formatDate(event.end, "Y-MM-DD HH:mm:ss");
                     $.ajax({
                         url: 'edit-event.php',
                         data: 'title=' + event.title + '&start=' + start + '&end=' + end + '&id=' + event.id,
                         type: "POST",
                         success: function (response) {
                             displayMessage("Updated Successfully");
                         }
                     });
                 },
         eventClick: function (event) {
             var deleteMsg = confirm("Do you really want to delete?");
             if (deleteMsg) {
                 $.ajax({
                     type: "POST",
                     url: "delete-event.php",
                     data: "&id=" + event.id,
                     success: function (response) {
                         if(parseInt(response) > 0) {
                             $('#calendar').fullCalendar('removeEvents', event.id);
                             displayMessage("Deleted Successfully");
                         }
                     }
                 });
             }
         }

     });
 });

 function displayMessage(message) {
       $(".response").html("<div class='success'>"+message+"</div>");
     setInterval(function() { $(".success").fadeOut(); }, 1000);
 }
 </script>

 <style>
 body {
     margin-top: 50px;
     text-align: center;
     font-size: 12px;
     font-family: "Lucida Grande", Helvetica, Arial, Verdana, sans-serif;
 }

 #calendar {
     width: 700px;
     margin: 0 auto;
 }

 .response {
     height: 60px;
 }

 .success {
     background: #cdf3cd;
     padding: 10px 60px;
     border: #c3e6c3 1px solid;
     display: inline-block;
 }
 </style>


   <meta charset="utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <title>Focus Admin: Creative Admin Dashboard</title>
   <!-- ================= Favicon ================== -->
   <!-- Standard -->

   <link rel="shortcut icon" href="http://placehold.it/64.png/000/fff">
   <!-- Retina iPad Touch Icon-->
   <link rel="apple-touch-icon" sizes="144x144" href="http://placehold.it/144.png/000/fff">
   <!-- Retina iPhone Touch Icon-->
   <link rel="apple-touch-icon" sizes="114x114" href="http://placehold.it/114.png/000/fff">
   <!-- Standard iPad Touch Icon-->
   <link rel="apple-touch-icon" sizes="72x72" href="http://placehold.it/72.png/000/fff">
   <!-- Standard iPhone Touch Icon-->
   <link rel="apple-touch-icon" sizes="57x57" href="http://placehold.it/57.png/000/fff">
   <!-- Styles -->
   <link href="assets/css/lib/calendar2/pignose.calendar.min.css" rel="stylesheet">
   <link href="assets/css/lib/chartist/chartist.min.css" rel="stylesheet">
   <link href="assets/css/lib/font-awesome.min.css" rel="stylesheet">
   <link href="assets/css/lib/themify-icons.css" rel="stylesheet">
   <link href="assets/css/lib/owl.carousel.min.css" rel="stylesheet" />
   <link href="assets/css/lib/owl.theme.default.min.css" rel="stylesheet" />
   <link href="assets/css/lib/weather-icons.css" rel="stylesheet" />
   <link href="assets/css/lib/menubar/sidebar.css" rel="stylesheet">
   <link href="assets/css/lib/bootstrap.min.css" rel="stylesheet">
   <link href="assets/css/lib/helper.css" rel="stylesheet">
   <link href="assets/css/style.css" rel="stylesheet">



</head>

<body>

 <div class="sidebar sidebar-hide-to-small sidebar-shrink sidebar-gestures">
     <div class="nano">
         <div class="nano-content">
             <ul>
                 <div class="logo"><a href="index.html">
                         <!-- <img src="assets/images/logo.png" alt="" /> --><span>Aplicatie Proiect AS</span></a></div>
                 <li class="label">Main</li>
                 <li><a class="sidebar-sub-toggle"><i class="ti-home"></i> Dashboard <span
                             class="badge badge-primary">2</span> <span
                             class="sidebar-collapse-icon ti-angle-down"></span></a>
                     <ul>
                       <li><a href="index1.html">Dashboard 2</a></li>
                         <li><a href="index1.html">Dashboard 2</a></li>
                     </ul>
                 </li>

                 <li class="label">Apps</li>
                 <li><a class="sidebar-sub-toggle"><i class="ti-bar-chart-alt"></i> Administrare <span
                             class="sidebar-collapse-icon ti-angle-down"></span></a>
                     <ul>
                         <li><a href="app-profile.php">Profil</a></li>
                         <li><a href="app-event-calender.html">Pontaj</a></li>
                         <li><a class="sidebar-sub-toggle">Manageri<span
                         class="sidebar-collapse-icon ti-angle-down"></span></a>
                         <ul>
                           <li><a href="index1.html">Dashboard 2</a></li>
                             <li><a href="index1.html">Dashboard 2</a></li>
                         </ul>
                       </li>
                         <li><a href="chartist.html">Noutati</a></li>
                         <li><a href="chart-peity.html">Task List</a></li>
                         <li><a href="chart-sparkline.html">Raport situatie</a></li>
                         <li><a href="chart-sparkline.html">Raport situatie OLD</a>  </li>
                         <li><a href="chart-sparkline.html">Raport activitate</a></li>
                     </ul>
                 </li>
                 <li><a href=#><i class="ti-layout-grid2-alt"></i> Gospodarii</a></li>
                 <li><a href=#><i class="ti-layout-grid2-alt"></i> Beneficiari</a></li>
                 <li><a href=#><i class="ti-layout-grid2-alt"></i> Verificari</a></li>
                 <li><a href=#><i class="ti-layout-grid2-alt"></i> Instrumente</a></li>

                 <li class="label">Features</li>
                 <li><a class="sidebar-sub-toggle"><i class="ti-layout"></i> UI Elements <span
                             class="sidebar-collapse-icon ti-angle-down"></span></a>
                     <ul>
                         <li><a href="ui-typography.html">Typography</a></li>
                         <li><a href="ui-alerts.html">Alerts</a></li>

                         <li><a href="ui-button.html">Button</a></li>
                         <li><a href="ui-dropdown.html">Dropdown</a></li>

                         <li><a href="ui-list-group.html">List Group</a></li>

                         <li><a href="ui-progressbar.html">Progressbar</a></li>
                         <li><a href="ui-tab.html">Tab</a></li>

                     </ul>
                 </li>
                 <li><a class="sidebar-sub-toggle"><i class="ti-panel"></i> Components <span
                             class="sidebar-collapse-icon ti-angle-down"></span></a>
                     <ul>
                         <li><a href="uc-calendar.html">Calendar</a></li>
                         <li><a href="uc-carousel.html">Carousel</a></li>
                         <li><a href="uc-weather.html">Weather</a></li>
                         <li><a href="uc-datamap.html">Datamap</a></li>
                         <li><a href="uc-todo-list.html">To do</a></li>
                         <li><a href="uc-scrollable.html">Scrollable</a></li>
                         <li><a href="uc-sweetalert.html">Sweet Alert</a></li>
                         <li><a href="uc-toastr.html">Toastr</a></li>
                         <li><a href="uc-range-slider-basic.html">Basic Range Slider</a></li>
                         <li><a href="uc-range-slider-advance.html">Advance Range Slider</a></li>
                         <li><a href="uc-nestable.html">Nestable</a></li>

                         <li><a href="uc-rating-bar-rating.html">Bar Rating</a></li>
                         <li><a href="uc-rating-jRate.html">jRate</a></li>
                     </ul>
                 </li>
                 <li><a class="sidebar-sub-toggle"><i class="ti-layout-grid4-alt"></i> Table <span
                             class="sidebar-collapse-icon ti-angle-down"></span></a>
                     <ul>
                         <li><a href="table-basic.html">Basic</a></li>

                         <li><a href="table-export.html">Datatable Export</a></li>
                         <li><a href="table-row-select.html">Datatable Row Select</a></li>
                         <li><a href="table-jsgrid.html">Editable </a></li>
                     </ul>
                 </li>
                 <li><a class="sidebar-sub-toggle"><i class="ti-heart"></i> Icons <span
                             class="sidebar-collapse-icon ti-angle-down"></span></a>
                     <ul>
                         <li><a href="font-themify.html">Themify</a></li>
                     </ul>
                 </li>
                 <li><a class="sidebar-sub-toggle"><i class="ti-map"></i> Maps <span
                             class="sidebar-collapse-icon ti-angle-down"></span></a>
                     <ul>
                         <li><a href="gmaps.html">Basic</a></li>
                         <li><a href="vector-map.html">Vector Map</a></li>
                     </ul>
                 </li>
                 <li class="label">Form</li>
                 <li><a href="form-basic.html"><i class="ti-view-list-alt"></i> Basic Form </a></li>
                 <li class="label">Extra</li>
                 <li><a class="sidebar-sub-toggle"><i class="ti-files"></i> Invoice <span
                             class="sidebar-collapse-icon ti-angle-down"></span></a>
                     <ul>
                         <li><a href="invoice.html">Basic</a></li>
                         <li><a href="invoice-editable.html">Editable</a></li>
                     </ul>
                 </li>
                 <li><a class="sidebar-sub-toggle"><i class="ti-target"></i> Pages <span
                             class="sidebar-collapse-icon ti-angle-down"></span></a>
                     <ul>
                         <li><a href="page-login.html">Login</a></li>
                         <li><a href="page-register.html">Register</a></li>
                         <li><a href="page-reset-password.html">Forgot password</a></li>
                     </ul>
                 </li>
                 <li><a href="../documentation/index.html"><i class="ti-file"></i> Documentation</a></li>
                 <li><a href="../themes/logout.php"><i class="ti-close"></i> Logout</a></li>
             </ul>
         </div>
     </div>
 </div>
   <!-- /# sidebar -->

   <div class="header">
     <div class="container-fluid">
       <div class="row">
         <div class="col-lg-12">
           <div class="float-left">
             <div class="hamburger sidebar-toggle">
               <span class="line"></span>
               <span class="line"></span>
               <span class="line"></span>
             </div>
           </div>
           <div class="float-right">
             <div class="dropdown dib">
               <div class="header-icon" data-toggle="dropdown">
               <span class="user-avatar"><?php echo htmlspecialchars($_SESSION["username"]); ?>
                 </span>
                 <i class="ti-angle-down f-s-10"></i>
                 <div class="drop-down dropdown-profile dropdown-menu dropdown-menu-right">
                   <div class="dropdown-content-body">
                     <ul>
                       <li>
                         <a href="app-profile.php">
                           <i class="ti-user"></i>
                           <span>Profil</span>
                         </a>
                       </li>
                       <li><a href="http://localhost/Aplicatie/themes/logout.php"><i class="ti-close"></i> Logout</a></li>
                     </ul>
                   </div>
                 </div>
               </div>
             </div>
           </div>
         </div>
       </div>
     </div>
   </div>




   <div class="content-wrap">
       <div class="main">
           <div class="container-fluid">
               <div class="row">
                   <div class="col-lg-8 p-r-0 title-margin-right">
                       <div class="page-header">
                           <div class="page-title">
                               <h1>Bine ati venit!</h1>
                           </div>
                       </div>
                   </div>
                   <!-- /# column -->
                   <div class="col-lg-4 p-l-0 title-margin-left">
                       <div class="page-header">
                           <div class="page-title">
                               <ol class="breadcrumb">
                                   <li class="breadcrumb-item"><a href="#">Dashboard</a></li>
                                   <li class="breadcrumb-item active">Home</li>
                               </ol>
                           </div>
                       </div>
                   </div>
                   <!-- /# column -->
               </div>
               <!-- /# row -->
               <section id="main-content">
                   <div class="row">
                       <div class="col-lg-12">
                           <div class="card">
                               <div class="card-title">
                                   <h4>Pontaj </h4>
                                   <div class="float-sm-right">
                                   <button href="#" data-toggle="modal" align="right" data-target="#add-gosp" class="btn btn-primary btn-addon" type="button">
                                     <i class="ti-pencil-alt2"></i>Adauga gospodarie</button>
                                   </div>



                                   <div id='calendar'></div>
                                   <div class="row">



                               </div>
                           </div>
                           <!-- /# card -->
                       </div>
                       <!-- /# column -->
                   </div>
                   <!-- /# row -->
                   <div class="response"></div>

                       <div class="col-lg-12">
                           <div class="footer">
                               <p>2018 © Admin Board. - <a href="#">example.com</a></p>
                           </div>
                       </div>
                   </div>
               </section>

           </div>
       </div>
   </div>


   <!-- jquery vendor -->
   <script src="assets/js/lib/jquery.min.js"></script>
   <script src="assets/js/lib/jquery.nanoscroller.min.js"></script>
   <!-- nano scroller -->
   <script src="assets/js/lib/menubar/sidebar.js"></script>
   <script src="assets/js/lib/preloader/pace.min.js"></script>
   <!-- sidebar -->

   <script src="assets/js/lib/bootstrap.min.js"></script>
   <script src="assets/js/scripts.js"></script>
   <!-- bootstrap -->



   <!-- scripit init-->

</body>

</html>

我移动了声明,但我仍然找不到问题,当我摆脱了一个错误,另有两个弹出。

共有1个答案

班经亘
2023-03-14

我需要删除第二个jQuery。现在起作用了。谢谢你charlietfl!!

 类似资料:
  • 我想我可能加载错误的脚本,但我真的找不到问题。如果你有什么想法,将不胜感激。如果你有任何想法,请分享,因为我看了所有关于这个话题的帖子,我真的无法修复它 我移动了声明,但我仍然找不到问题,当我摆脱了一个错误,另有两个弹出。

  • 我想我可能加载错误的脚本,但我真的找不到问题。如果你有什么想法,将不胜感激。如果你有任何想法,请分享,因为我看了所有关于这个话题的帖子,我真的无法修复它 我移动了声明,但我仍然找不到问题,当我摆脱了一个错误,另有两个弹出。

  • 问题内容: 我是jQuery的新手,并在旧的教程上使用了以下代码段: 但是我得到这个错误 未捕获的TypeError:$ .ajax(…)。成功不是函数 在 我想知道这里有什么问题吗? 问题答案: 对ajax的调用应如下所示: 您没有方法链接成功函数,它是字典参数中的条目之一。

  • 不知何故,我无法正确使用slick carousel(http://kenwheeler.github.io/slick/)。 我得到以下错误: 我正在javascript文件中运行以下代码: 我已经在Bower中包含了最新的jQuery版本(2.1.4)。我还尝试在布局模板文件的头部包含jQuery CDN,但这也没有解决任何问题。 唯一奇怪的是,当我不使用函数来调用滑块时,它确实起作用,但它给

  • 我正在使用InstaFeed从Instagram获取图片并在网站上展示。 这是我的代码: 我对JS和JQuery很陌生,但我不知道为什么会出现这个错误。错误在以下行: var images=$(“#instafeed”)。find('a');

  • 我有一个模态在我的页面。当我尝试在windows加载时调用它时,它会向控制台打印一个错误,该错误表示: 这是我的模态HTML: null 这是加载窗口时使用的JavaScript: 如何修复此问题?