77 lines
3.1 KiB
JavaScript
77 lines
3.1 KiB
JavaScript
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": "<hashed_email_address>", // string. The email of the customer if available. It must be hashed with SHA-256 on the client side.
|
|
"phone_number": "<hashed_phone_number>", // string. The phone number of the customer if available. It must be hashed with SHA-256 on the client side.
|
|
"external_id": "<hashed_extenal_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": "<content_identifier>", // string. ID of the product. Example: "1077218".
|
|
"content_type": "<content_type>", // string. Either product or product_group.
|
|
"content_name": "<content_name>" // string. The name of the page or product. Example: "shirt".
|
|
}
|
|
],
|
|
"value": "<content_value>", // number. Value of the order or items sold. Example: 100.
|
|
"currency": "<content_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){
|
|
document.querySelector(".register").innerHTML = data.responseJSON.html
|
|
}
|
|
});
|
|
}
|
|
|
|
|