html - 从 HTML 页面提交 "pure"HTTP 请求

标签 html http

我需要从一个 HTML 页面向我的 REST 服务器发送以下 HTTP 请求以检索另一个页面。如何使用 javascript 或表单或链接或其他方式做到这一点?

请注意,HTTP 请求正文必须像表单通常那样包含没有键/值对的纯文本。

PUT /somerequest HTTP/1.1
Host: www.myhost.com
Accept: text/html,application/xhtml+xml

Payload of the request to be read by the server script.
The script will return a HTML content to my browser.
Thanks !

最佳答案

你可以使用 jQuery 吗?

http://api.jquery.com/jQuery.ajax/

我相信你会在那里找到你想要的。

如果不看下层:XMLHttpRequest

http://www.w3.org/TR/XMLHttpRequest/

关于html - 从 HTML 页面提交 "pure"HTTP 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11161970/

相关文章:

html - 我怎样才能把这个按钮放到我的#second div 中?

jquery - 使用 Twitter Bootstrap 的响应式布局

java - 如何保持多个 Java HttpConnections 打开到同一个目的地

ruby - 在 ruby​​ 中使用 Net::HTTP 代理通过代理访问网站

java - multipart/form-data 和 application-x-www-form-urlencoded 有什么区别?

HTTPS : how to change default http port 8080 to another value 上的 Java Spring Boot

html - 使用 :after to clear floating elements

html - 具有绝对位置的 CSS Float

http - 如何在 Flutter/Dart http 请求对象上设置 header ?

javascript - 使用不同的单击事件后,jQuery 单击事件未触发