PHP Classes

File: js/main.js

Recommend this page to a friend!
  Classes of Ann   Purp Project   js/main.js   Download  
File: js/main.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Purp Project
Application to manage photo albums
Author: By
Last change: Update of js/main.js
Date: 1 year ago
Size: 2,846 bytes
 

Contents

Class file image Download
$(document).ready(function(){ $('.login-btn').click(function(e){ e.preventDefault(); let login = $('input[name="login"]').val(), password = $('input[name="password"]').val(); $.ajax({ url: 'php/signin.php', type: 'POST', dataType: 'json', data: { login: login, password: password }, success: function(data){ console.log(data); if(data.status == true){ //alert("???? ???????? ???????"); document.location.href = '../profile.php'; }else{ //alert("???? ?? ????????"); if (data.type === 1) { data.fields.forEach(function (field) { $(`input[name="${field}"]`).addClass('error'); }); } $('.msg').removeClass('none').text(data.message); // document.location.href = '../signin.php'; } } }) }); $('.register-btn').click(function (e) { e.preventDefault(); // console.log(avatar); $(`input`).removeClass('error'); let login = $('input[name="login"]').val(), age = $('input[name="age"]').val(), password = $('input[name="password"]').val(), email = $('input[name="email"]').val(), gender = $('select[name=gender]').val(); check_password = $('input[name="check_password"]').val(); let url = $('#form').attr('action'); $.ajax({ url: 'php/reg.php', type: 'POST', // dataType: 'json', data: { login: login, password: password, check_password: check_password, age: age, gender: gender, email: email // avatar: avatar }, success: function(resp){ console.log(resp); $('.msg').addClass('none'); if(resp.message == "??????????? ?????? ???????!"){ //alert("true"); document.location.href = '../login.php'; }else{ //alert("false"); // if (resp != "") { // // data.fields.forEach(function (field) { // $(`input[name="${field}"]`).addClass('error'); // // }); // } $('.msg').removeClass('none').text(resp.message); // document.location.href = '../signin.php'; } } }) }) });