Skip to content

Commit b056803

Browse files
author
Sinan Özata
committed
fix
1 parent 2bf390a commit b056803

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

index.html

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -625,22 +625,31 @@ <h2>Contact</h2>
625625
$('.output_message').text('Loading...');
626626

627627
var form = $(this);
628-
$.ajax({
629-
url: "email.php",
630-
method: form.attr('method'),
631-
data: form.serialize(),
632-
success: function(result){
633-
if (result == 'success'){
634-
$('.output_message').text('Message Sent!');
635-
} else {
636-
$('.output_message').text('Error Sending email!');
637-
}
638-
},
639-
error: function(ex){
640-
console.log(ex);
628+
629+
$.ajaxSetup({
630+
headers: {
631+
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
632+
}
633+
});
634+
635+
$.ajax({
636+
url: "email.php",
637+
method: form.attr('method'),
638+
data: form.serialize(),
639+
contentType: "application/json;charset=utf-8",
640+
crossDomain : true,
641+
success: function(result){
642+
if (result == 'success'){
643+
$('.output_message').text('Message Sent!');
644+
} else {
645+
$('.output_message').text('Error Sending email!');
641646
}
642-
643-
});
647+
},
648+
error: function(ex){
649+
console.log(ex);
650+
}
651+
652+
});
644653

645654
// Prevents default submission of the form after clicking on the submit button.
646655
return false;

0 commit comments

Comments
 (0)