gpt4 book ai didi

post - dojo.xhrPost 的参数

转载 作者:行者123 更新时间:2023-12-05 01:37:40 25 4
gpt4 key购买 nike

当我使用 dojo.xhrGet 时,我使用这种方式通过 GET

发送多个参数
dojo.xhrGet
({
url:"MyServerPageURL?Param_A="+"ValueA"+"&Param_2="+"Value2",
load: function(data)
{
//do something
},
preventCache: true,
sync: true,
error: function(err)
{
alert("error="+err);
}
});

当我不得不使用 dojo.xhrPost 时,我怎么能做类似的事情(发送多个参数)?

最佳答案

你不想使用 postData 参数,除非你想发送一个原始的 POST 字符串。您通常希望使用“内容”参数。例如:

dojo.xhrPost({
url: 'http://whatever...',
contents: {
ParamA: 'valueA',
ParamB: 'valueB'
},
load: function(response) {
// ...
}
});

注意:使用“内容”也适用于 xhrGet,无需自己构建查询字符串并附加到 URL。

关于post - dojo.xhrPost 的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5746332/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com