Invoking a Go Server from Java Script code involving Google Maps API

go, google-app-engine, google-maps, javascript

Solution

As well as ajax communication in general way, from the map to the server with GET/POST method.

There are tons of library though, one of the famous library is jQuery.

1) Download jQuery library from official page. http://jquery.com/

2) Deploy to appengine.

3) Try a simple code:

<script src="/js/jquery.min.js"></script>
<script>
jQuery.post("http://yourapp.appspot.com/test/", {
  message : "helloworld"
}, function(response){
  alert(response);
});
</script>

4) You also need your GO script to process POST access for "http://yourapp.appspot.com/test/". (Sorry I'm not familiar with GO language, yet)

5) Googling keywords "ajax jQuery".

I hope this steps help you.

Problem

I am making a project for my Distributed Systems Class in Go that demonstrates distributed storage and fault tolerance. The back-end is all in GO - I essentially have 2 major functions Add(Args) and Get(Args) in GO. My front-end is a Web page with Google Maps. The event handlers on the map would be Javascript functions. I can easily extract information like Center of Map, or map frame bounds from the Google Maps API. My problem is: I don't know how to "call" the GO function/program in the back-end with information from my JavaScript function. I am very new to Web development, so I apologize if this is painfully obvious. On googling, the only approach I found is running the GO program as some sort of http server on google app engine. I am unsure about the details though. I'd be happy if someone gives me some references, or points me in the right direction!

Original source