This is my ajax request:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".emailfocusout").focusout(function(){
$.ajax({
url: '/checkout/Email/Email',
type: 'POST',
data: {'email': '[email protected]'},
contentType: 'application/json',
success: function(data) {
console.log('SUCCESS: ', data);
},
error: function(data) {
console.log('ERROR: ', data);
},
});
});
});
</script>
This is my controller:
public function EmailAction()
{
// TODO: Implement me! Here are some hints ;-)
$email = $this->getRequest()->getParam('email');
var_dump($email);
echo $email;
}
I can't save - data: {'email': '[email protected]'} - to - $email = $this->getRequest()->getParam('email');
What am I doing wrong?
* UPDATE - SOLVED * I took data out of the ajax request. And in URL I put:
url: '/checkout/Email/Email/email/[email protected]',
I worked like that.