最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python's urllib.urlopen for javascript - Stack Overflow

programmeradmin2浏览0评论

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 0
Add a ment  | 

1 Answer 1

Reset to default 5

You 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;
发布评论

评论列表(0)

  1. 暂无评论