-(function(){
- 'use strict';
-
- $( document ).ready(function(){
- $('.jsform').on('click', 'input[type="submit"]', function(e){
- var form_data = new FormData(this.parentElement);
- var form = $(this).parent();
- var xhr = new XMLHttpRequest();
- xhr.open(form.attr('method'), form.attr('action'));
- xhr.onload = function() {
- $('#result').html(this.responseText);
- };
- xhr.onerror = function() {
- $('#result').html('Error!');
- };
- window.scrollTo(0, 0);
- $('#result').html('Loading...');
- xhr.send(form_data);
- return false;
- });
+$(function(){
+ const result = q('#result');
+ $('.jsform > input[type="submit"]').on('click', e => {
+ const form_data = new FormData(this.parentElement);
+ const form = this.parentNode;
+ const xhr = new XMLHttpRequest();
+ xhr.open(form.getAttribute('method'), form.getAttribute('action'));
+ xhr.onload = () => result.innerHTML = this.responseText;
+ xhr.onerror = () => result.innerHTML = 'Error!';
+ window.scrollTo(0, 0);
+ result.innerHTML = 'Loading...';
+ xhr.send(form_data);
+ e.preventDefault();