I want to save user email
to database when he clicks the subscribe button. But when I enter email and click the subscribe button it passes an empty array!
Subscribe form code:
<form id="cx-subscribe-user">
<input type="text" name="email" id="email" placeholder="Enter Your Email" />
<button type="submit" id="subscribe-button">Subscribe</button>
</form>
Js code:
$('#cx-subscribe-user').on('click', function (e) {
e.preventDefault();
var email = $('#email').val();
$.ajax({
type: "GET",
url: "subscribe-the-user.php",
processData: false,
dataType: 'json',
data: {email: email},
success: function(data) {
console.log('saved scucess');
}
});
});
In subscribe-the-user.php
file I'm trying to var_dump the request but it's printing empty array:
var_dump($_GET);exit;
In var_dump I receive this empty array
array(0) {}