File tree Expand file tree Collapse file tree 1 file changed +24
-15
lines changed Expand file tree Collapse file tree 1 file changed +24
-15
lines changed Original file line number Diff line number Diff line change @@ -625,22 +625,31 @@ <h2>Contact</h2>
625
625
$ ( '.output_message' ) . text ( 'Loading...' ) ;
626
626
627
627
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!' ) ;
641
646
}
642
-
643
- } ) ;
647
+ } ,
648
+ error : function ( ex ) {
649
+ console . log ( ex ) ;
650
+ }
651
+
652
+ } ) ;
644
653
645
654
// Prevents default submission of the form after clicking on the submit button.
646
655
return false ;
You can’t perform that action at this time.
0 commit comments