On craft2 site I used the script provided for if else statments
$('#my-form').submit(function(ev) {
// Prevent the form from actually submitting
ev.preventDefault();
// Send it to the server
$.post({
url: '/',
dataType: 'json',
data: $(this).serialize(),
success: function(response) {
if (response.success) {
$('#thanks').fadeIn();
} else {
// response.error will be an object containing any validation errors that occurred, indexed by field name
// e.g. response.error.fromName => ['From Name is required']
alert('An error occurred. Please try again.');
}
}
});
});
But this does not work in craft 3
The success statement does not work
success: function(response) {}
If you need to see working examples, I have sites in both craft2 and 3 to show the issue, as I am in the middle of a migrate.
On craft2 site I used the script provided for if else statments
$('#my-form').submit(function(ev) { // Prevent the form from actually submitting ev.preventDefault();
});
But this does not work in craft 3
The success statement does not work
success: function(response) {}
If you need to see working examples, I have sites in both craft2 and 3 to show the issue, as I am in the middle of a migrate.