Is there a module written in javascript that's equivalent to python's urllib? In particular, I want something like:
urllib.urlopen(url, data)
which returns an object that supports a blocking fetch. Alternatively, in what other ways could I perform a blocking request to a server using javascript?
Is there a module written in javascript that's equivalent to python's urllib? In particular, I want something like:
urllib.urlopen(url, data)
which returns an object that supports a blocking fetch. Alternatively, in what other ways could I perform a blocking request to a server using javascript?
Share Improve this question edited Mar 9, 2022 at 18:09 OneCricketeer 192k20 gold badges143 silver badges268 bronze badges asked Jul 9, 2012 at 20:12 rjkaplanrjkaplan 3,4485 gold badges30 silver badges34 bronze badges 01 Answer
Reset to default 5You can use the normal XMLHttpRequest synchronously:
var xhr = new XMLHttpRequest();
xhr.open('POST', url, false); # third param is sync/async
xhr.send(data);
var response = xhr.responseText;