I am trying to make a Chrome extension. Currently I have an AWS database running on MySQL workbench and I am trying to get it connected to the extension. My PHP file is simply just trying to connect to the database on the submit of an HTML form. I am following the videos (parts 1-4) form this link https://www.youtube.com/watch?v=dpLbADRh830
Right now I am using localhost as my server and on submit of the form, my extension says "This site can’t be reached localhost refused to connect." I have no clue where to go from here and this is honestly my first database experience so I apologize if this is a silly problem.
<?php
$name=$_POST['name'];
$email=$_POST['email'];
if(!isset($_POST['submit'])){
echo $email;
}
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form action="http://localhost/db/tester_script.php" method="POST">
<input type="text" name="name" placeholder="name"><br>
<input type="text" name="email" placeholder="email"><br>
<input type="submit" value="submit">
</form>
</body>
</html>
Here is how I fixed the solution:
<body>
<form id="thing">
<input type="text" id="name" name="name" placeholder="name"><br>
<input type="text" id="email" name="email" placeholder="email">
<input type="submit" id="submit" value="submit">
</form>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>
$("#thing").on("submit", function(){
var name = $("#name").val();
var email = $("#email").val();
$.ajax({
type: "POST",
url: "http://localhost:8000/tester_script.php",
data: {name : name, email : email},
success : function(data){
console.log(data);
}
});
return false;
})
</script>
</body>