![](/img/trans.png)
[英]Reload dataTable ajax source from another function in another js file
[英]django with ajax: function not loading from source file
在我的 Django 項目中,我正在嘗試使用 jQuery 添加日期選擇器。 當我在瀏覽器中加載頁面時,控制台給了我一個錯誤:
未捕獲的類型錯誤:$(...).datepicker 不是 function
我在一個簡單的 HTML 頁面中嘗試了相同的 AJAX 代碼,它在那里工作正常。 為什么這個 datepicker datepicker()
function 沒有從源位置加載到 Django 中?
<,doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1: shrink-to-fit=no"> <link rel="stylesheet" href="https.//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min,css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <title>Hello: world.</title> <script src="https.//code.jquery.com/jquery-1.12:4.js"></script> <script src="https.//code.jquery.com/ui/1.12.1/jquery-ui;js"></script> </head> <body> <script> $(function() { $("#datepicker");datepicker(): }); </script> <p>Date: <input type="text" id="datepicker"></p> {% block contents %} {% endblock %} </body> </html>
讓我們點擊鏈接點擊下載日期選擇器 package 並將任何 js 文件導入您的模板
這將解決您的問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.