使用jquery构建ajax请求,添加标题和正文

时间:2015-08-22 16:30:48

标签: javascript jquery ajax post

如何使用$ .ajax或$ .post构建带有这些信息的Jquery请求:

POST /CreateSpeech HTTP/1.1

Host: tts.eu-west-1.ivonacloud.com

Content-type: application/json

X-Amz-Date: 20130913T092054Z

Authorization: AWS4-HMAC-SHA256 Credential=12345/20130913/eu-west-1/tts/aws4_request, 

SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, 

Signature=38c394cf938da94ec503f501a91055bc9aa339d165695884b9e7e60128f6ad27

x-amz-content-sha256: f43e25253839f2c3feae433c5e477d79f7dfafdc0e4af19a952adb44a60265ba

Content-Length: 32

{"Input":{"Data":"Hello world"}}

1 个答案:

答案 0 :(得分:0)

This has been answered here

您需要在headers属性中添加标题信息(不要放在第一行),然后像在data属性中一样添加内容。