skip to Main Content

Here is my script code:

<script src="//code.jquery.com/jquery.js" defer></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" defer></script>
<script src="//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js" defer></script>

I try to create an ajax function, but it show some error in console :

Uncaught ReferenceError: $ is not defined

How can I proceed?

2

Answers


  1. This error means your jQuery file has not been loaded. Based on your code, you have to remove one of the script tags that load the jQuery library. Then check that the path for loading jQuery is correct. You can do that by viewing the page source (in most browsers ctrl+u) and clicking on the script address and check if the file loads correctly.

    Login or Signup to reply.
  2. Your file can’t be found. Try to replace your code from your current code to this.

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="http://cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search