function SendRegistrationForm(el, user_id){ event.preventDefault() let form = el.form; let formData = new FormData(form); let url = '/user_account/password_recovery_confirm/' formData.set('user_id', user_id) if(!el.classList.contains('recovery')){ url = '/user_account/registration/'; let msr = sessionStorage.getItem('mailingSubscribeRequired') formData.set('mailingSubscribeRequired',msr) } $.ajax({ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, url: url, type: "POST", // async: true, cache: false, processData: false, contentType: false, // enctype: 'json', data: formData, success: function(data){ const confirmPasswordElement = document.getElementById('confirm_password'); if (confirmPasswordElement) { confirmPasswordElement.innerHTML = data.message; } const infoTextElement = document.querySelector('.info_text'); if (infoTextElement) { infoTextElement.classList.add('show'); } // location.href = `/profile/page/dashboard/` window.sessionStorage.removeItem('mailingSubscribeRequired') window.sessionStorage.removeItem('email') fbq('track', 'Contact'); // ttq.identify({ // "email": "", // string. The email of the customer if available. It must be hashed with SHA-256 on the client side. // "phone_number": "", // string. The phone number of the customer if available. It must be hashed with SHA-256 on the client side. // "external_id": "" // string. Any unique identifier, such as loyalty membership IDs, user IDs, and external cookie IDs.It must be hashed with SHA-256 on the client side. // }); // ttq.track('CompleteRegistration', { // "contents": [ // { // "content_id": "", // string. ID of the product. Example: "1077218". // "content_type": "", // string. Either product or product_group. // "content_name": "" // string. The name of the page or product. Example: "shirt". // } // ], // "value": "", // number. Value of the order or items sold. Example: 100. // "currency": "" // string. The 4217 currency code. Example: "USD". // }); if(typeof ym === 'function'){ ym(97070898,'reachGoal','Registration') return true; }else { console.log('Скрипт Яндекс.Метрики не найден. Статистика не будет отправлена.'); } }, error: function (data, exception){ if(data.responseJSON.html){ document.querySelector(".register").innerHTML = data.responseJSON.html } else if(data.responseJSON.error){ const passwordInput = document.querySelector('input[name="pass"]'); if (passwordInput && data.responseJSON.error) { passwordInput.placeholder = data.responseJSON.error; passwordInput.value = ''; passwordInput.classList.add('error'); } } } }); }