jQuery Ajax加载不是函数 [英] jQuery ajax load not a function

查看:81
本文介绍了jQuery Ajax加载不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个例子

<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加载函数的示例相同.正如代码片段可以告诉您的那样,它实际上是错误的,

seemed to me like it is identical to the examples for the ajax load function. As the code snippet can tell you, it actually errors out with

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

我在做什么错了?

推荐答案

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

https://code.jquery.com/jquery-3.2.1.slim.min.js is the slim edition of jquery, which does not include ajax. slim is the default version included in an Express server. Use the full version of jquery at https://code.jquery.com/jquery-3.2.1.min.js

这篇关于jQuery Ajax加载不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆