jqueryajaxjquery-load

jQuery ajax load not a function


This example

<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>

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

What am I doing wrong?


Solution

  • 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