summaryrefslogtreecommitdiff
path: root/includes/utils.js
diff options
context:
space:
mode:
authorGuillaume Mazoyer <respawneral@gmail.com>2014-05-29 14:28:48 +0200
committerGuillaume Mazoyer <respawneral@gmail.com>2014-05-29 14:28:48 +0200
commit1a3e5a5bb861f59cbcdede94a82f0984e97ea002 (patch)
tree519d53ff3981c161b18d00ef0ca3caf85387f5c1 /includes/utils.js
parentf8b05a1fed71b89b1cd7524e4f64b317af1ab7a4 (diff)
Apache 2.4 configuration to avoid to access the config.php file.
First import of the whole source code (quite monolithic for now). Update configuration example.
Diffstat (limited to 'includes/utils.js')
-rw-r--r--includes/utils.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/includes/utils.js b/includes/utils.js
new file mode 100644
index 0000000..3bcde51
--- /dev/null
+++ b/includes/utils.js
@@ -0,0 +1,41 @@
+$(function() {
+ // hide the optional parameters field
+ $('.result').hide();
+ $('.loading').hide();
+
+ // show and hide loading bar
+ $(document).ajaxStart(function() {
+ $('.loading').show();
+ });
+ $(document).ajaxStop(function() {
+ $('.loading').hide();
+ });
+
+ // validate the parameters field
+ $('#input-params').on('input', function() {
+ var cmd = $('#query').val();
+ });
+
+ // reset the view to the default one
+ $('#backhome').click(function() {
+ $('.content').slideDown();
+ $('.result').slideUp();
+ });
+
+ // send an ajax request that will get the info on the router
+ $('form').on('submit', function(e) {
+ e.preventDefault();
+
+ $.ajax({
+ type: 'post',
+ url: 'execute.php',
+ data: $('form').serialize()
+ }).done(function(response, state, xhr) {
+ $('#output').text(response);
+ $('.content').slideUp();
+ $('.result').slideDown();
+ }).fail(function(xhr, state, error) {
+ alert('The following error occured: ' + state, error);
+ });
+ });
+});