This line includes the jQuery library.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
None of those that you sent is an Ajax!
If you're getting any server errors it's related to your PHP files!
You need to make an API to contact with your server.
Create a PHP file and paste these lines in that file
$posts = [
['title' => 'Post Title', 'body' => 'Post Body!']
];
print_r(json_encode($posts));
Here is an example of a free API, If you want to use the above code replace URL with the URL of PHP file.
$("#ajax-trigger").click(function(){
$.ajax({
url: "https://jsonplaceholder.typicode.com/posts",
type: 'GET',
success: function(result){
$.each(result,function(index, postObj){
$('div').append("<h2>" + postObj.title + "</h2><p>" + postObj.body + "</p>");
});
},
error: function(error) {
console.log(error.status);
},
beforeSend: function(){
$('#status').html('<strong>Loading...</strong>');
},
complete: function(){
$('#status').empty();
},
statusCode: {
404: function() {
alert( "page not found" );
}
},
});
});
<head>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body bgcolor='#f9f9f9'>
<p id="status" style="position:absolute; left:45%; top:30%; font-size:35px;"></p>
<div class='p-3'>
<button id='ajax-trigger' class='btn btn-success d-block w-75 mx-auto my-3'>Click Here</button>
</div>
</body>