从JavaScript中进行发布/获取请求的最佳方法

发布于 2025-01-22 20:02:08 字数 383 浏览 1 评论 0 原文

我正在学习JavaScript。我想从JavaScript到Django后端执行并发布请求。

有人告诉我, ajax已过时,我应该使用一个框架,例如React,Angular或Vue。我将开始学习反应,但首先我想知道是否有现代/更喜欢从JavaScript执行API请求的方法。

“提取”。这可能是要走的路吗?

I'm learning JavaScript. I want to perform GET and POST request from JavaScript to/from a Django Backend.

I was told that AJAX is outdated, that I should use a framework, like React, Angular or Vue. I'll start to learn React, but first I would like to know if theres a modern/prefered way to perform API request from JavaScript.

In this article "fetch" is mentioned. Could be this the way to go?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒与心事 2025-01-29 20:02:08

您无需使用JS框架即可完成,JavaScript具有可以为您提供很多帮助的现代功能。实际上,我完全同意您列出的文章的“获取”,如果我在Vanilla JavaScript中,我总是会寻求这种要求。

You do not need to use a JS Framework to do so, and Javascript has modern features that can help you a lot. In fact, I totally agree with the "fetch" of the article you pined, and I always go for this kind of request if I am in vanilla Javascript.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文