I'm not sure why I'm not able to post the content of email field,
here is my code.
<html>
<head>
<title></title>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
</head>
<body>
<input type="text" id="email" name="email">
<input type="button" id="submit" name="submit" value="submit">
</body>
<script type="text/javascript">
$(document).ready(function () {
$('#submit').click(function (event) {
var email = $('#email').val();
console.log(email),
$.ajax({
url: 'db.php',
type: 'POST',
data: 'email=' + 'email',
success: function (data) {
console.log(data);
}
})
});
});
</script>
</html>
backend file "db.php"
<?php
$email = $_POST['email'];
echo "$email";
I'm able to console.log email, and displays correctly, before it gets submitted to db.php.
console log returns "email" only.
Not sure whats wrong, your help is highly appreciated.
Thanks