Hey everyone, this code below is giving me a weird error, Script 438: Object doesn't support property or method 'ajax'. I am testing this in Microsoft Edge, but...I have a website that uses this exact same code, and its working like normal. I am getting the var id to load properly, I am not sure why it is not working, since, its working on the other site. I copied and pasted the code to match exact. anywho, its stating that it at the $.ajax({ line.

<script>
$(function(){
    $('.get-msg').click(function(){
    var id = $(this).attr('data-id');
    $.ajax({
          type : 'GET',
           url : 'viewmessage.php',
          data :  'dataID='+ id,
          success : function(r){

              $('#messageModal').modal('show');
             $('#messageBody').show().html(r);
            }
        });
    });
});
</script>

if(isset($_GET['dataID']) && is_numeric($_GET['dataID'])){
     $id = mysqli_real_escape_string($link, $_GET['dataID'] );
     $query = "SELECT * FROM `jobs` WHERE `id`='$id' LIMIT 1";
     $result = mysqli_query($link, $query);
     $message = "";
     if($result){
         $row = mysqli_fetch_assoc($result);
         $message .= '<div><h4>Title: </h4><h5>'.$row['title'].'<h5></div>';
         $message .= '<hr><br>';
         $message .= '<div><b>Job Description:<br>'.$row['description'].'</b></div>';
         $message .= '<hr><br>';
         $message .= '<div><b>Rate:<br>'.$row['rate'].'</b></div>';
         echo $message;
     }else{
         echo "No such data"; 
     }
}

Recommended Answers

All 4 Replies

Hi rproffitt, I am unable to run this on chrome either, its throwing the error that $.ajax is not a function??? I never heard of this.

$.ajax is not a function sounds right to me but I'm not big on your code. Sometimes folk get code from the web and it's just broken.

PS. Adding with edit. Did you check for syntax errors by opening your browser's JS/debug console?

It was something completely stupid, I was using the slim version of jQuery CDN, instead of the full version. It was a simple mistake that was overlooked until i went and examined the code. Once i put the full version, it resolved the issue i was having. UGH, i feel stupid at times. haha!

commented: Thanks for sharing. Usually helps others when we reveal what it was. +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.