bik*_*shg 3 dojo post get parameter-passing
当我使用时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);
}
});
Run Code Online (Sandbox Code Playgroud)
当我不得不使用它时,我怎么能做类似的事情(发送多个参数)dojo.xhrPost?
除非要发送原始POST字符串,否则不希望使用postData参数.您通常希望使用'content'参数.例如:
dojo.xhrPost({
url: 'http://whatever...',
contents: {
ParamA: 'valueA',
ParamB: 'valueB'
},
load: function(response) {
// ...
}
});
Run Code Online (Sandbox Code Playgroud)
注意:使用'contents'也适用于xhrGet,无需自己构建查询字符串并附加到URL.