GopherJS AJAX

304 views
Skip to first unread message

thomas.b...@gmail.com

unread,
May 2, 2016, 9:04:26 AM5/2/16
to golang-nuts
Hello,

I am starting to translate a JS code into GopherJS (as a way to learn it).
What is the equivalent of the AJAX request code:

var req = new XMLHttpRequest();
req.open(...);
req.onreadystatechange = function() {...}

Thanks,

Thomas

Ian Lance Taylor

unread,
May 2, 2016, 9:42:28 AM5/2/16
to thomas.b...@gmail.com, golang-nuts
Asking here is fine, but it might be more useful to ask questions
about GopherJS on the gopherjs mailing list
(https://groups.google.com/forum/#!forum/gopherjs). (I don't know the
answer myself.)

Ian

Tim K

unread,
May 2, 2016, 10:01:44 AM5/2/16
to golang-nuts, thomas.b...@gmail.com
There is also a Slack channel if you prefer a more interactive discussion:
https://gophers.slack.com/messages/gopherjs/

Daniel Skinner

unread,
May 2, 2016, 10:06:24 AM5/2/16
to Tim K, golang-nuts, thomas.b...@gmail.com
I tried out gopherjs a month or so back and simply used net/http from the std lib.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raffaele Sena

unread,
May 2, 2016, 12:55:44 PM5/2/16
to Daniel Skinner, Tim K, golang-nuts, thomas.b...@gmail.com
Somebody recently mentioned this package on Slack: https://github.com/PalmStoneGames/gopherjs-net-http
It should be compatible with the net/http APIs, but only implements the client methods.

-- Raffaele

Brian Ketelsen

unread,
May 2, 2016, 3:31:16 PM5/2/16
to golang-nuts, dan...@dasa.cc, tim....@gmail.com, thomas.b...@gmail.com
This is probably where you should start.  It's a port of the net/http lib without the server-side bits.

Here's a toy project I'm doing to learn gopherjs, and a specific ajax call:

Thomas Bellembois

unread,
May 3, 2016, 3:17:54 AM5/3/16
to golang-nuts

Thanks all for your answers. I will look at your suggestions.

Thomas
Reply all
Reply to author
Forward
0 new messages