<script type="text/javascript">
function doDBSetPost() {
+ $(".submitbody").toggle(false);
+ $(".setupbody").toggle(false);
+ $(".beginbody").toggle(false);
+ $(".reportbody").toggle(false);
+ $(".loadingbody").toggle(true);
$(function() {
var frm = $(document.dbsetsform);
var dat = JSON.stringify(frm.serializeArray());
frm.attr("action"),
dat,
function(data) {
- alert("Response: " + data);
+ //alert("Response: " + data);
}
);
});
<form method="post" action="/json" name="dbsetsform">
<table>
<tr><td>Database Type</td><td><input type="text" name="dbtype"></td></tr>
-<tr><td>Database Host</td><td><input type="text" name="dbtype"></td></tr>
-<tr><td>Database Username</td><td><input type="text" name="dbtype"></td></tr>
-<tr><td>Database Password</td><td><input type="text" name="dbtype"></td></tr>
-<tr><td>Database</td><td><input type="text" name="dbtype"></td></tr>
-<tr><td>Data Multiplier</td><td><input type="text" name="dbtype"></td></tr>
-<tr><td>Number of Clients</td><td><input type="text" name="dbtype"></td></tr>
+<tr><td>Database Host</td><td><input type="text" name="dbhost"></td></tr>
+<tr><td>Database Username</td><td><input type="text" name="dbuser"></td></tr>
+<tr><td>Database Password</td><td><input type="text" name="dbpass"></td></tr>
+<tr><td>Database</td><td><input type="text" name="dbname"></td></tr>
+<tr><td>Data Multiplier</td><td><input type="text" name="datamult"></td></tr>
+<tr><td>Number of Clients</td><td><input type="text" name="nclients"></td></tr>
</table>
<input type="submit" name="Go" value="Go" onClick="doDBSetPost(); return false">
</form>
var cominstatus chan string;
var comout chan string;
+var stat int;
+
func JSONResponder(c *http.Conn, req *http.Request)
{
//stat := <- cominstatus;
if(req.Method == "GET") {
- j, _, _ := json.StringToJson("{\"status\":1, \"complete\":90}");
+ j, _, _ := json.StringToJson(fmt.Sprintf("{\"status\":%d, \"complete\":90}", stat));
io.WriteString(c, fmt.Sprintf("%s\n", json.JsonToString(j)));
fmt.Printf("i got a get\n");
lp := make([]byte, 1048576);
req.Body.Read(lp);
fmt.Printf("i got a post...%s\n", (string)(lp));
- http.Redirect(c, "/", 301);
+ //http.Redirect(c, "/", 301);
+ stat = 2;
}
}
cominstatus = make(chan string);
comout = make(chan string);
+ stat = 1;
bc := benchcontroller.CreateController();
go benchcontroller.MainLoop(bc, comout, comin, cominstatus);