-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetData.go
49 lines (37 loc) · 899 Bytes
/
getData.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"fmt"
"net/http"
"github.com/julienschmidt/httprouter"
)
//////////////////////////////////////////
//////////////////////////////////////////
/////// Not in use!
//////////////////////////////////////////
//////////////////////////////////////////
/// Get ...
func Get(r *http.Request, key string) string {
v, ok := r.URL.Query()[key]
if !ok {
return ""
}
return v[0]
}
/// GetSlice ...
func GetSlice(r *http.Request, key string) (v []string) {
v, ok := r.URL.Query()[key]
if !ok {
return v
}
return v
}
// AjaxGetData
func ajaxGetData(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
fmt.Println("ajax/get-data foldered")
fmt.Printf("%v\n", p)
get := r.URL.Query()
fmt.Printf("%v\n", get)
fmt.Println(get["pair_id"])
fmt.Println(Get(r, "pair_id"))
fmt.Println(Get(r, "asfs"))
}