]>
Commit | Line | Data |
---|---|---|
7093e9ba | 1 | $(function(){ |
dee46c5b | 2 | const result = q('#result'); |
8345760a | 3 | $('.jsform > input[type="submit"]').on('click', e => { |
65d5cb3b MG |
4 | const form_data = new FormData(this.parentElement); |
5 | const form = this.parentNode; | |
6 | const xhr = new XMLHttpRequest(); | |
7093e9ba | 7 | xhr.open(form.getAttribute('method'), form.getAttribute('action')); |
8345760a MG |
8 | xhr.onload = () => result.innerHTML = this.responseText; |
9 | xhr.onerror = () => result.innerHTML = 'Error!'; | |
7093e9ba | 10 | window.scrollTo(0, 0); |
8345760a | 11 | result.innerHTML = 'Loading...'; |
7093e9ba MG |
12 | xhr.send(form_data); |
13 | e.preventDefault(); | |
eef56f7a | 14 | }); |
7093e9ba | 15 | }); |