title: How to solve this "Uncaught ReferenceError: $ is not defined"
body: <p>I have some code where I need to update a column of a table (MySQL) calling another php file without leaving the page where some tables might allow inline editing.</p>
  
  <p>I have a point in the php echoing of the page, where an icon can be clicked to save input. The code at that point is:</p>
  
  <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;?php
  $sql = "SELECT * FROM table WHERE a_column='certain_value'";
  if (mysqli_query($conn, $sql)) {
      $result = mysqli_query($conn, $sql);
      if (mysqli_num_rows($result) &gt; 0) {
          while($row = mysqli_fetch_assoc($result)) {
              $note = $row["note"];
              $code = $row["code"];
          }
      }
  }
  // some tabled elements not relevant for the issue
  echo "&lt;input type='text' id='note_1' name='note_1' value=$note readonly&gt;";
  echo "&lt;input type='text' id='new_note' name='new_note'&gt;";
  echo "&lt;img src='icon_to_click.png' id='icon_to_click' name='icon_to_click' &gt;";
  ?&gt;
  
  &lt;script type="text/javascript"&gt;
  
  $(document).ready(function() {
      $('#icon_to_click').click(function() {
          var note_orig = document.getElementById('note_1').value;
          var code_val = '&lt;?php echo "$code" ?&gt;';
          var note_new = document.getElementById('new_note').value;
          if (note_new != note_orig) {
              $.ajax({
                  type: 'POST',
                  url: 'update_notes.php',
                  data: {'code': code_val, 'note': note_new},
                  success: function(response){
                      document.getElementById('note_1').value = note_new;
                  }
              });
          }
      });
  });
  </code></pre>
  
  <p>The relevant code of update_notes.php is:</p>
  
  <pre><code>&lt;?php 
  
  // connection
  
  $unsafe_note = $_POST["note"];
  $code = $_POST["code"];
  require "safetize.php"; // the user input is made safe
  $note = $safetized_note; // get the output of safetize.php
  
  $sqlupdate = "UPDATE table SET note='$note' WHERE code='$code'";
  if (mysqli_query($conn, $sqlupdate)) {
      echo "Note updated";
  } else {
      echo "Problem in updating";
  }
  
  // close connection
  
  ?&gt;
  </code></pre>
  
  <p>Now when I run the code and look at the tool, it gives me the error: <em>Uncaught ReferenceError: $ is not defined</em>, linking the error to this line of the previous js code:</p>
  
  <pre><code>$(document).ready(function() {
  </code></pre>
  
  <p>So, how can I fix that?</p>