When a form titled "functions_question2" is submitted, the following PHP code should dictate what happens
<?php
if (isset($_POST['functions_question2'])) {
    if ($id) {
        $res3 = $db->query("SELECT * FROM answers WHERE user_id=$id");
        $data3 = $res3->fetch_array();
        if (isset($_SESSION['functions_question2']) && $_POST['functions_question2'] == $_SESSION['functions_question2']) {  
          if ($data3['FunctionsPercent'] > 50 && $data3['FunctionsPercent'] < 100) {
            $db->query("UPDATE answers SET FunctionsPercent = 50 WHERE user_id=$id");
            echo'<script type="text/javascript" src="insert.js"></script>'; 
            //***THIS IS THE PART THAT'S GIVING ME TROUBLE.
          }
        }
    }
}
?>
Within the external page insert.js, I have the following code:
<script type='text/javascript'>
$(document).ready(function(){
 $(".incorrectanswermark").fadeIn('slow');
});
</script>
All of the rest of the PHP executes correctly (the MySQL database updates), and there are no console errors. Also, I double-checked to make sure the div that's supposed to show up when the form submits does indeed have the class incorrectanswermark.
Any help would be much appreciated. Thanks!
 
    