php - jQuery .keyup() function -
i'm not receiving output code. error.
terminal.html
<html> <head> <link href="/css/webterminal.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="jquery-1.5.2.js"/> <script type="text/javascript"> function shell_execute(str) { $.ajax({ url: 'exec.php', datatype: 'text', data: { q: str }, success: function (response) { $('#txtout').append(response); }); } </script> </head <body"> <div class="container"> <h2>unix web based terminal 1.0</h2> <br /> <p><b>output</b></p> <form> <span id="user"></span>< <input type="text" id="txtcmd" onkeyup="shell_execute(this.value)" class="textbox" size="20" /> </form> <div class="output"> <p><span id="txtout"></span></p> </div> </div> </body> </html> exec.php
<?php $q=$_get["q"]; $output=shell_exec($q); echo "<pre>$output</pre>"; ?>
you need value text input element , put str before pass script.
like:
var str = $("#txtcmd").val();
Comments
Post a Comment