How to send request to localhost

Is there a way to load jQuery into snap? My problem is, I'm trying to port this scratchx extension for minecraft into snap, but it uses jQuery, and I don't know of a way to get around that..

edit: ok, I don't need jquery anymore, but I do need a way to send a request to a localhost.

My guess is that you can use a jQuery to Javascript converter.

Lord help us!

Guys this extension just sends "http" requests to localhost

ext.move = function (direction, callback) {
        var command = `move?direction=${direction}`;
        client.async_command(command, callback, "success");

is really a URL block "http://localhost:8080/move?direction=forward"

There are ~30 blocks that must be manually created (Scratchx extensions are not compatible with Snap!).

  blocks: [
            ['w', 'Move %m.sixDirections', 'move', 'forward'],
            ['w', 'Turn %m.rotateDirections', 'turn', 'left'],

Probably a suitable private MC server, proper edition, is required.

What you are trying to achieve? Recreate Hour Of Code challenges? Or extend a server?

Well, I'm trying to connect code connection to snap. That way I don't have to set up a custom server, just use code connection.

If tat's it, then I gues I don't need jquery. I'll have to test that out to make sure it actually works.

edit: just entering the url into the web browser works, and the page contents is


but whenever I use it in the url block in snap, nothing happens.

edit 2: just checked the console, and it says

GET http://localhost:8080/connected net::ERR_FAILED

Can't you just use the URL or the http request block?

I did, but it doesn't work for some reason (or at least for my purpose)

There is an API doc
"connected" endpoint is not described there.
Why do not test "move?direction=forward"

Idk why it's not, because connected tests whether it's connected to minecraft (also thanks for the docs)

It doesn't really matter which url I use because it'll just result in the error.

edit: I read the docs, and it said that you have to send REST queries. I'm not sure how to do it in snap, or if snap already does that in the url block.

I have no Minecraft so
untitled script pic - 2022-01-20T211940.977

I don't even ask if you start "Code Connection" app...

That's weird. It looks like it's working for you. btw, error code 2 is just that it's not connected to minecraft, so therefore it cannot run commands.

edit: I just tried it in google chrome, and it's working. How come I can't do it in my preferred browser (brave)?

edit 2: apparently brave shields was blocking the request, even though it said it wasn't blocking anything.