parent
43746485d4
commit
3b174e3d60
|
|
@ -8,10 +8,34 @@
|
|||
if (form[i].name)
|
||||
items[form[i].name] = form[i].value
|
||||
}
|
||||
console.log(items)
|
||||
var params = "?"
|
||||
for(var k in items) {
|
||||
params += k + "=" + items[k] + "&"
|
||||
}
|
||||
params = params.substr(0, params.length-1)
|
||||
http("GET", "http://localhost:18114/who" + params, function(body, status) {
|
||||
console.log(status, "body=",body)
|
||||
}, null)
|
||||
return false;
|
||||
}
|
||||
|
||||
function http(method, remote, callback, body) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
|
||||
console.log("KK", xmlhttp.readyState, xmlhttp.responseText, xmlhttp.status)
|
||||
callback(xmlhttp.responseText, xmlhttp.status)
|
||||
}
|
||||
};
|
||||
xmlhttp.open(method, remote, true);
|
||||
if (typeof body == "undefined") {
|
||||
body = null
|
||||
}
|
||||
xmlhttp.send(body);
|
||||
}
|
||||
function callback(responseBody, responseStatus) {
|
||||
}
|
||||
|
||||
function draw(one) {
|
||||
var id = one.id
|
||||
var meta = one.meta
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"local/whodunit/config"
|
||||
"local/whodunit/storage"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
|
@ -37,9 +38,10 @@ func who(g storage.Graph, w http.ResponseWriter, r *http.Request) error {
|
|||
return err
|
||||
}
|
||||
if len(ones) != 1 {
|
||||
ones = nil
|
||||
ones = append(ones, storage.One{})
|
||||
}
|
||||
results[id] = ones[0]
|
||||
}
|
||||
log.Println("results:", results)
|
||||
return json.NewEncoder(w).Encode(results)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue