Permalink
Browse files

Changed the javascript to use commands controller now.

  • Loading branch information...
1 parent a6d6716 commit 519b442272707e8151c8476850ef502dcc2deff6 @ratnikov ratnikov committed Feb 22, 2010
Showing with 24 additions and 4 deletions.
  1. +24 −4 public/javascripts/application.js
@@ -2,8 +2,28 @@
// This file is automatically included by javascript_include_tag :defaults
$(document).ready(function(){
$("#command_command").focus();
-
-
+
+ jQuery("#command").submit(function(e) {
+ e.preventDefault();
+
+ var command = jQuery(':text#command_command').val();
+
+ jQuery.ajax({
+ dataType: 'json',
+ type: 'POST',
+ url: '/commands',
+ data: { command: command },
+ success: function(data) {
+ if (typeof data.output !== 'undefined') {
+ jQuery(".result").append(jQuery("<pre>").html(data.output));
+ }
+
+ jQuery("#command_command").scrollTo();
+ }
+ });
+ });
+
+/*
$("#command").submit(function(){
$.post(
"/shell/",
@@ -25,7 +45,7 @@ $(document).ready(function(){
}
);
});
-
+ */
$("#username").submit(function(){
console.log("it happened...")
});
@@ -41,4 +61,4 @@ function checkJson(key, value) {
}
}
return value;
-}
+}

0 comments on commit 519b442

Please sign in to comment.