guild/backend/web/js/site.js

49 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-09-06 10:29:50 +03:00
alert(123);
2020-01-17 16:28:25 +03:00
$(function(){
$('#options').change(function(){
month = $('#options :selected').val();
history.pushState({}, '', month);
$.pjax.reload({container:"#reload"});
})
2020-01-23 13:16:54 +03:00
});
$(document).on("beforeSubmit", "#password-form", function (e) {
let form = $(this);
let formData = form.serialize();
let location = document.location.href;
location = location.split('=');
formData = formData.split('=');
console.log(formData[2]);
$.ajax({
url: 'ajax',
type: 'POST',
data: {
id: location[1],
password: formData[2],
},
password: formData[2],
success: function (response) {
window.location.replace('index');
},
error: function () {
}
});
});
$(document).ready(function () {
$('.generate').on('click', function () {
$(".custom-input").val(gen_password(8));
});
});
function gen_password(len){
var password = "";
var symbols = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < len; i++){
password += symbols.charAt(Math.floor(Math.random() * symbols.length));
}
return password;
}