File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,12 @@ window.wplf = {
88 submitHandler : function ( e ) {
99 var form = e . target ;
1010 var data = new FormData ( form ) ;
11+
12+ // prevent submitting the form again when a submission is already in progress
13+ if ( form . classList . contains ( 'sending' ) ) {
14+ e . preventDefault ( ) ;
15+ return ;
16+ }
1117
1218 // Pass language if it exists.
1319 ajax_object . lang && data . append ( 'lang' , ajax_object . lang ) ;
@@ -28,7 +34,7 @@ window.wplf = {
2834 return response . text ( ) ;
2935 } ) . then ( function ( response ) {
3036 response = JSON . parse ( response ) ;
31-
37+
3238 if ( 'success' in response ) {
3339 // show success message if one exists
3440 var success = document . createElement ( "p" ) ;
@@ -145,4 +151,4 @@ window.wplf = {
145151 document . addEventListener ( 'DOMContentLoaded' , function ( ) {
146152 initialize ( dependencies , main ) ;
147153 } ) ;
148- } ( ) ) ;
154+ } ( ) ) ;
You can’t perform that action at this time.
0 commit comments