I have created a registration form.i have set the cookies,now my question is, when i click on submit button,all the details which user has given has to be stored in the next page using cookies.how do i proceed.
CodePudding user response:
You can handle form submit and store all the details which user has given into cookies.
forms.addEventListener("submit", function() {
// Handle your data and store them in cookies then you can use them in next page
});
Hope you only use this for learning or development purposes, this is not a good way to handle a registration form!
CodePudding user response:
Rather than cookies I prefer localStorage.
you can just store user token in localStorage using setItem()
method and delete data for logouts using removeItem()
. If you want to see if token is still there in localStorage you use getItem()
method.