$(document).ready(function() { window.myAfterSendedFunction = function($form) { /* $form - jquery объект ссылающийся на форму */ /* номер заявки (Lead ID) */ var formresult = $form.data('tildaformresult'); var leadid = formresult.tranid; /* все поля заявки */ var formArr = $form.serializeArray(); console.log(formArr, formresult); let priceSelector = 'div.t706__cartwin-prodamount-wrap > span.t706__cartwin-prodamount'; let productsSelector = 'div.t706__cartwin-products > div.t706__product'; let titleSelector = 'div.t706__product-title'; let returnUrl = document.location.href; let serviceKey = '18a38687953db9edcdd15bae7de7edf6'; let products = []; document.querySelectorAll(productsSelector).forEach((product) => { products.push(product.querySelector(titleSelector).textContent); }); let description = products.join(', '); let price = Number.parseInt(document.querySelector(priceSelector).innerText.replace(/ /g, ''), 10).toFixed(2) let data = new URLSearchParams({ type: 'direct', paymentMethodId: 2, //card and others serviceKey: serviceKey, orderId: formresult.orderid, description: description, currency: 'RUB', amount: price, returnUrl: returnUrl, }); window.location = 'https://pay.cypix.ru/form?'.concat(data.toString()); } $('.t706 form').each(function() { $(this).data('formsended-callback', 'window.myAfterSendedFunction'); }); window.randomStr = function (len) { return Math.random().toString(len); } });