-(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(){
+ $('.jsform > input[type="submit"]').on('click', function(e){
+ var form_data = new FormData(this.parentElement);
+ var form = this.parentNode;
+ var xhr = new XMLHttpRequest();
+ xhr.open(form.getAttribute('method'), form.getAttribute('action'));
+ xhr.onload = function() {
+ $('#result')[0].innerHTML = this.responseText;
+ };
+ xhr.onerror = function() {
+ $('#result')[0].innerHTML = 'Error!';
+ };
+ window.scrollTo(0, 0);
+ $('#result')[0].innerHTML = 'Loading...';
+ xhr.send(form_data);
+ e.preventDefault();
});
-})();
+});