$(document).ready(function(){ $('.message a').click(function(){ $('form').animate({height: "toggle", opacity: "toggle"},"slow"); }) }); async function submitForm(e, form){ e.preventDefault(); try { const response = await fetch('https://mkr.thefeathers.in/register', { method: 'post', body: JSON.stringify({ "username": form.formName.value, "email": form.formEmail.value, "password": form.formPassword.value, }) }); const data = await response.json(); //Success code goes here //window.location = "searchmovies.html"; alert(JSON.stringify(data)); $('form').animate({ height: "toggle", opacity: "toggle" }, "slow"); } catch (err) { //Failure alert('Error'); } } async function submitForm1(e, form){ e.preventDefault(); try { const response = await fetch('https://mkr.thefeathers.in/login', { method: 'POST', body: JSON.stringify({ "username" : document.getElementById('formName1').value, "password" : document.getElementById('formPassword1').value }) }); const data1 = await response.json(); //Success code goes here alert(JSON.stringify(data1)); window.location = "searchmovies.html"; } catch (err) { //Failure alert('Error'); } }