jquery
This commit is contained in:
		
							
								
								
									
										19
									
								
								public/js/login.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								public/js/login.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
$(document).ready(() => {
 | 
			
		||||
    $("#loginForm").submit(() => {
 | 
			
		||||
        $.ajax({
 | 
			
		||||
            type: "POST",
 | 
			
		||||
            url: "/api/login",
 | 
			
		||||
            data: JSON.stringify({
 | 
			
		||||
                username: $("#username").val(),
 | 
			
		||||
                password: $("#password").val(),
 | 
			
		||||
            }),
 | 
			
		||||
            contentType: 'application/json',
 | 
			
		||||
            success: function() {
 | 
			
		||||
                window.location.href = "/index";
 | 
			
		||||
            },
 | 
			
		||||
            error: function(xhr) {
 | 
			
		||||
                alert (xhr.responseText);
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
    })
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										20
									
								
								public/js/register.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								public/js/register.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
$(document).ready(() => {
 | 
			
		||||
    $("#registerForm").submit(() => {
 | 
			
		||||
        $.ajax({
 | 
			
		||||
            type: "POST",
 | 
			
		||||
            url: "/api/register",
 | 
			
		||||
            data: JSON.stringify({
 | 
			
		||||
                username: $("#username").val(),
 | 
			
		||||
                password: $("#password").val(),
 | 
			
		||||
                inviteToken: $("#inviteToken").val()
 | 
			
		||||
            }),
 | 
			
		||||
            contentType: 'application/json',
 | 
			
		||||
            success: function() {
 | 
			
		||||
                window.location.href = "/index";
 | 
			
		||||
            },
 | 
			
		||||
            error: function(xhr) {
 | 
			
		||||
                alert (xhr.responseText);
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
    })
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user