开发者

XML for Ajax PUT or POST request

开发者 https://www.devze.com 2022-12-14 23:54 出处:网络
I\'m looking to write some Javascript which will m开发者_运维知识库ake an Ajax PUT or POST request to an HTTP server. I\'m assuming that the information which gets passed as the argument to request.se

I'm looking to write some Javascript which will m开发者_运维知识库ake an Ajax PUT or POST request to an HTTP server. I'm assuming that the information which gets passed as the argument to request.send needs to be in XML format. Could somebody shoe me an example of how to create this XML and pass it to request.send([Entity-body]) as the entity-body.

Thanks!


The "xml" in XmlHttpRequest is entirely superfluous; there's never been a requirement that the request or the response is in xml format.

In fact, it's just as common to send JSON (JavaScript object notation) instead of xml.

So, don't use xml unless you want to. Just send any string you want.


You don't have to send xml, you can send any arbitrary string.

an example for http post would be

request.send("id=1&somattribute=value&etc=etcetc");

where you have name value pairs

name=value

separated by &

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号