I'm trying to post newsletter form data to a php
page with ajax
but when I echo $_SERVER['REQUEST_METHOD']
on the php
page it prints GET
(with no variables). I have used similar code on multiple websites with no problems. (jquery v3.2.1
)
$.ajax({
method: 'post',
dataType: 'json',
url: '<?=$site_url?>/templates/xxxx/contact_send/email_send.php',
data: JSON.stringify(dataString),
contentType: 'application/JSON;charset=UTF-8',
success: function () {
console.log('success');
}
});
Network log
echo $_SERVER['REQUEST_METHOD']
Response