Skip to content

Commit

Permalink
Work on the AJAX calls for Project 4
Browse files Browse the repository at this point in the history
  • Loading branch information
czenzel committed Feb 17, 2024
1 parent 882e984 commit 2f47472
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project1/src/Bootstrap/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function header()
<!DOCTYPE html>
<html>
<head>
<title>Project 1</title>
<title>Project</title>
</head>
<body>
EOL;
Expand Down
3 changes: 2 additions & 1 deletion project2/src/Bootstrap/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function header()
<!DOCTYPE html>
<html>
<head>
<title>Project 1</title>
<title>Project</title>
</head>
<body>
EOL;
Expand All @@ -25,6 +25,7 @@ public function header()
public function scripts_body()
{
$scripts = <<<EOL
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
EOL;
Expand Down
5 changes: 5 additions & 0 deletions project3/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ main
{
margin-top: 25px;
}

.alert-api
{
display: none;
}
4 changes: 4 additions & 0 deletions project3/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger alert-api" role="alert">
<h4 class="alert-heading">Warning</h4>
<p>You have entered an invalid VIN number that was previouslly recgonized. In a perfect production application you would get the exact exception and show it here.</p>
</div>
<div id="vehicles">
<?php
$table->render();
Expand Down
3 changes: 3 additions & 0 deletions project3/js/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ function load_ajax_submission() {
url: "/ajax.php",
data: formData
}).done(function (data) {
$('.alert-api').hide();
$('#vehicles').html(data);
}).fail(function (jqXHR, textStatus, errorThrown) {
$('.alert-api').show();
});

event.preventDefault();
Expand Down
2 changes: 1 addition & 1 deletion project3/src/Bootstrap/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function header()
<!DOCTYPE html>
<html>
<head>
<title>Project 1</title>
<title>Project</title>
</head>
<body>
EOL;
Expand Down
3 changes: 2 additions & 1 deletion project4/src/Bootstrap/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function header()
<!DOCTYPE html>
<html>
<head>
<title>Project 1</title>
<title>Project</title>
</head>
<body>
EOL;
Expand All @@ -25,6 +25,7 @@ public function header()
public function scripts_body()
{
$scripts = <<<EOL
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
EOL;
Expand Down

0 comments on commit 2f47472

Please sign in to comment.