jQuery ajax 加载不是一个函数

标签 jquery ajax jquery-load

这个例子

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<div id="test"></div>
<script>
$(document).ready(() => {
  $('#test').load('doesntmatter');
});
</script>

在我看来,它与 ajax load function 的示例相同。正如代码片段可以告诉您的那样,它实际上会出错

Uncaught TypeError: $(...).load is not a function

我做错了什么?

最佳答案

https://code.jquery.com/jquery-3.2.1.slim.min.js是 jquery 的精简版,不包含 ajax。 slim 是 Express 服务器中包含的默认版本。使用完整版本的 jquery https://code.jquery.com/jquery-3.2.1.min.js

关于jQuery ajax 加载不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46003790/

相关文章:

javascript - 由于 JQuery 冲突,没有页面刷新的 JQuery 表单提交无法正常工作

jquery - 使用 jQuery 将具有相对路径的外部 HTML 页面加载到 DIV 中

jquery - 日期选择器 jquery 插件无法通过 jquery 加载方法在另一个页面中工作

jquery - 错误:Request header field Content-Type is not allowed by Access-Control-Allow-Headers

android - 如何减少android phonegap中的加载时间

php - 使用 GET 的 AJAX API

php - 如何在不离开页面的情况下将姓名插入数据库并在提交页面上显示多个表单

jQuery UI 对话框内容显示在按钮部分

javascript - $.get 不是函数

javascript - 在 .load() 中的元素上使用 jQuery