Skip to content

Instantly share code, notes, and snippets.

@Sentinel-7
Created August 24, 2021 15:13
Show Gist options
  • Save Sentinel-7/a04173d208b12a21a49ab17fdb5058c6 to your computer and use it in GitHub Desktop.
Save Sentinel-7/a04173d208b12a21a49ab17fdb5058c6 to your computer and use it in GitHub Desktop.
Добавляем url после отправки формы AjaxForm
$(document).on('af_complete', function (event, response) {
$('#getAQuoteModal').modal('hide');
if (response.success) {
$('#thanks').modal('show');
let form = $(response.form[0]);
form.attr('action', '-%thks');
let url = window.location.href;
if (url.match(/\?/)) {
url += '&';
} else {
if (! url.match(/\/$/)) url += '/';
};
url += form.attr('action');
history.pushState({}, '', url);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment