]> iEval git - plack-app-gruntmaster.git/blobdiff - js/90-form.js
Update js: -jquery -bootstrap +zepto +bootstrap-dropdown +form
[plack-app-gruntmaster.git] / js / 90-form.js
diff --git a/js/90-form.js b/js/90-form.js
new file mode 100644 (file)
index 0000000..a326ca8
--- /dev/null
@@ -0,0 +1,21 @@
+(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!');
+                       };
+                       $('#result').html('Loading...');
+                       xhr.send(form_data);
+                       return false;
+               });
+       });
+})();
This page took 0.026997 seconds and 4 git commands to generate.