$.ajax is not a function ( on full version of jQuery )

55 Views Asked by At

ajax is not a function on full version of jQuery ( i tried minified and cdn both ). first i thought it is because of bootstrap cdn so removed it but problem still there. i searched online and i find main issue due to slim version of jquery but here i used full versions and i tried so many version but problem is still there please help me

head data

<!DOCTYPE html>
<html lang="en">
<head>
    <script
    src="https://code.jquery.com/jquery-3.6.0.min.js"
    integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
    crossorigin="anonymous"
  ></script>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
    <link rel="stylesheet" href="/app.css"> 
    
    <title>New Project</title>
</head>

my code

function save(){
        $.ajax({
            type: 'POST',
            url: 'http://localhost:3000/post',
            data: { name : "name", content : "content"},
            dataType: 'json'
        });
}
1

There are 1 best solutions below

1
Paul J.K On

You need to include script at the end of body tag

<body>
   //

   <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
   <script>
      function save(){
         $.ajax({
            type: 'POST',
            url: //url,
            data: //data,
            dataType: 'json'
         });
      }
   </script>
</body>