Changed the code to this now. Form is located in subscribe.php which in included into the index page.
<form class="subscribe" id="email" method="get">
<input class="email" id="emailaddress" name="email" type="text" placeholder="EXAMPLE@EMAIL.COM" required>
<input class="button" type="submit" id="emailSub" value="Subscribe">
</form>
<div id="subResult"></div>
Jquery is at bottom of the index page
$(document).ready(function() {
$('#emailSub').click(function() {
var email = $('#emailaddress').val();
alert(email);
$.ajax({
type: "GET",
dataType: 'script', //<-Data Type for AJAX Requests(xml | html | script | json)
url: 'checksub.php',
data: {
'e': email
},
success: function(result) {
$("#subResult").html(result);
}
});
})
});
Checksub page is this now for testing.
<?php include 'admin/includes/db_connection.php'; ?>
<?php
$email = mysqli_real_escape_string($db, $_GET['e']);
echo "test string:";
echo $email;
?>