]> iEval git - gruntmaster-page.git/blob - js/90-form.js
25a11f771640cdaeaa71bd1df4cc7e72b41731eb
[gruntmaster-page.git] / js / 90-form.js
1 $(function(){
2 $('.jsform > input[type="submit"]').on('click', function(e){
3 var form_data = new FormData(this.parentElement);
4 var form = this.parentNode;
5 var xhr = new XMLHttpRequest();
6 xhr.open(form.getAttribute('method'), form.getAttribute('action'));
7 xhr.onload = function() {
8 $('#result')[0].innerHTML = this.responseText;
9 };
10 xhr.onerror = function() {
11 $('#result')[0].innerHTML = 'Error!';
12 };
13 window.scrollTo(0, 0);
14 $('#result')[0].innerHTML = 'Loading...';
15 xhr.send(form_data);
16 e.preventDefault();
17 });
18 });
This page took 0.044864 seconds and 3 git commands to generate.