我可以执行“PUT”操作吗? ajax 调用本地文件类似于“GET”调用方式 作品?

发布于 2024-08-01 20:21:02 字数 213 浏览 6 评论 0原文

如果我从 file:// 加载 HTML,并且在 HTML 中有一个针对相对 URL 的 AJAX“GET”请求,则意味着该 URL 指向一个文件并且该文件已加载。

我可以对“PUT”有类似的行为吗? 意思是用 AJAX 数据覆盖文件的内容?

我需要这个,这样我就可以轻松调试脚本,而无需设置 HTTP 服务器来托管它们并回复请求的 URL。

谢谢

If I load an HTML from file:// and in the HTML there's an AJAX 'GET' request to a relative URL, it means the URL is pointing to a file and the file is loaded.

Can I have a similar behavior for 'PUT'? Meaning overwrite the file's content with the AJAX data?

I need this so I can easily debug scripts without the need to setup an HTTP server to host them and reply to the requested URLs.

Thank you

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

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

发布评论

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

评论(3

兮颜 2024-08-08 20:21:03

ExtJs 在 Ajax 调用上具有完整的 REST。 使用“核心”版本是免费的。

查看他们的在线文档:http://extjs.com/products/extcore/manual/

ExtJs has full REST on Ajax calls. Using the "core" release is free.

Check out their online documentation : http://extjs.com/products/extcore/manual/

嘿哥们儿 2024-08-08 20:21:02

据我所知,当前浏览器中的 HTML/脚本模型不允许更改本地资源(有点像沙箱 - 想想如果 HTML 页面可以写入本地文件会发生什么混乱)。 file:// 只是告诉浏览器它正在寻找的资源位于其运行的计算机本地的一种方式,因此它不需要利用网络。 因此您可以从脚本中读取本地资源 - 而不是更改它们。

为什么不直接运行本地网络服务器呢? 无论如何你最终都会需要它。

As far as I know, the HTML/script model in current browsers does not allow changing local resources (sort of a sandbox - think of the mess that would occur if an HTML page could write to a local file). The file:// is just a way to tell the browser a resource it's looking for is local to the machine it's running on, so it won't need to utilize the network. So you can read local resources from script - not change them.

Why not just run a local web server? You'll need it anyway eventually.

花伊自在美 2024-08-08 20:21:02

我不这么认为。 数据将发布到哪里以及由什么来处理?

I don't think so. Where would the data post to and what would process it?

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