I send some data using jquery in the jsonp format :
console.log(data.location.lng);
console.log(data.location.lat);
console.log(data.accuracy);
var urlgr = "http://127.0.0.1:9220/geo/rec_geo/";
var pfg = {
    //lo: data.location.lng,
    lo: 1.0,
    //la: data.location.lat,
    la: 2.0,
    //ac: data.accuracy,
    ac: 3,
};
$.ajax({
    type: 'GET',
    url: urlgr,
    crossDomain: true,
    data: JSON.stringify(pfg),
    dataType: 'jsonp',
    contentType: "application/json; charset=utf-8",
    success: function (data) {
        console.log("data rec geo");
        console.log(data);
    }
});
here is my code in golang to receive it :
type geoData struct {
    Long float32 `json:"lo"`
    Lat   float32  `json:"la"`
    Accuracy  int `json:"ac"`
}
func recordGeo(w http.ResponseWriter, r *http.Request) {
    s := strings.Split(r.RemoteAddr, ":")
    ip := s[0]
    Info.Println("4")
    var geoRec geoData
    decoder := json.NewDecoder(r.Body)
    err := decoder.Decode(&geoRec)
    fmt.Println("geoRec")
    fmt.Println(geoRec)
    checkErr(err)
}
but i have a EOF error :
2017/07/01 07:16:22 http: panic serving 127.0.0.1:50680: EOF
So my question is how to properly receive a jsonp request in golang and parse it to a struct ?
here is the request that i get in the golang server side :
GET /geo/rec_geo/?callback=jQuery31108538596418163691_1498913991164&{%22lo%22:1,%22la%22:2,%22ac%22:3}&_=1498913991166 HTTP/1.1
Host: 127.0.0.1:9220
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
accept-encoding: gzip, deflate, sdch, br
accept-language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
referer: http://localhost:8080/
cookie: csrftoken=Y7WA181u22l9sScw9UbPxM38wCGQzjaLMMysAesJSWZm89Pj6CCdBkEF01ibpUjW
alexatoolbar-alx_ns_ph: AlexaToolbar/alx-4.0.1
connection: keep-alive
edit removed the : Info.Println line but i still have the same error
thanks
 
     
     
    