javascript - Simple form that hides after sumbmiting -


as title says. when submit form dissapears second , after reload of browser shows again. css mess right i'm trying things out.

<div id="new_user_form"      style="         width: 400px;         height: 200px;          background-color: grey;">     <form onsubmit="hide_show()" style="display: block;     margin: 0 auto;          width: 100%;">         new nickname: <input type="text" required><br>         new password: <input type="password" required>         <br><input type="submit">     </form> </div>  <script>     function hide_show(){         document.getelementbyid("new_user_form").style.display="none";      } </script> 

if want submit form , after submit succeeds hide user without refreshing page, should submit through ajax.

an informative example: https://scotch.io/tutorials/submitting-ajax-forms-with-jquery

basically submit form through ajax , when request succeeds - hide form user.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -