Tag Archives: Ajax

Ajax with Golang

Lately, I thought of trying my hands on the classic Ajax alongside Go language. The requirement is to write a simple web server which sends ‘current timestamp’ to the requester every second. I have written a small program to do exactly the same. The Ajax part is taken care by jquery.

In order to see it in action, one needs to run it “go run tick-tock.go”. When the program is running, it essentially becomes a tiny web server listening to requests at port ‘9999’.

Now all you need to do is fire up a browser and raise a request to the tick-tock server: http://localhost:9999/time

Go is awesome. Isn’t it?