Skip to content

Commit dadd96e

Browse files
committed
mention client side callbacks in readme.md
1 parent 488a530 commit dadd96e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

readme.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@ wp_enqueue_script('wplf-form-js');
8989
wp_localize_script( 'wplf-form-js', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
9090
```
9191

92+
### Client side callbacks
93+
94+
WP Libre Form supports client side callbacks after form submission using window.wplf object. Example usage:
95+
96+
```
97+
window.wplf.successCallbacks.push(function(response){
98+
alert("You succesfully submitted form " + response.form_id);
99+
});
100+
101+
window.wplf.errorCallbacks.push(function(response){
102+
alert("Form submission failed!");
103+
});
104+
```
105+
106+
These callbacks are executed in the order they appear.
107+
92108
### Add own css classes to form output
93109

94110
You can use the attribute xclass inside the shortcode to set own extra css classes.

0 commit comments

Comments
 (0)