0

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"; 
     }
}
2
Contributors
4
Replies
32
Views
4 Months
Discussion Span
Last Post by patk570
0

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.

0

$.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?

Edited by rproffitt: Clarifying

3

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!

Votes + Comments
Thanks for sharing. Usually helps others when we reveal what it was.
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.