jQuery ajax发布电子邮件字段

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

You are sending string "email", while you want to send a variable value:

$.ajax({
    url: 'db.php',
    type: 'POST',
    data: 'email=' + email, // or data: {email: email}
    success: function (data) {
        console.log(data);
    }
});

Use this it will help

<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>

</div>