Hello, I'm working with a form and I try to execute some JS when form submission is a success. By looking the doc, I can read :
specifies JavaScript code to execute after the request is successfully completed. Inside the JavaScript code you can access the following variables: this (the page element triggered the request), the context object, the data object received from the server, the textStatus text string, and the jqXHR object.
Here is my code :
<form class="default" data-request="form::onFormSubmit" data-request-success="formSubmit();">
And my JS :
function formSubmit() {
console.log(this);
console.log(context);
console.log(data);
console.log(textStatus);
console.log(jqXHR);
}
only "this" return something, for contect, I get the following error :
Uncaught ReferenceError: context is not defined
If somebody can help me to access all variables that should be accessible in that function.
Thanks
Last updated