如何在JSON请求头中设置参数?
我想在JSON请求头中设置userId和密码,并在JSON请求体中设置其余参数。可以举一个例子,我如何在JSON请求头中设置userId/password,在JSON请求体中设置others参数 提前感谢。使用Jquery:如何在JSON请求头中设置参数?,json,rest,Json,Rest,我想在JSON请求头中设置userId和密码,并在JSON请求体中设置其余参数。可以举一个例子,我如何在JSON请求头中设置userId/password,在JSON请求体中设置others参数 提前感谢。使用Jquery: <script> //submit request $.post('url',{userId: userIdvalue, Password: password value,...},function(response){ // do something when
<script>
//submit request
$.post('url',{userId: userIdvalue, Password: password value,...},function(response){
// do something when request processed successfully
});
//if you submit a form
$.post('url',{$("#formId".serialize())},function(response){
// do something when request processed successfully
});
</script>
//提交请求
$.post('url',{userId:userIdvalue,Password:Password value,…},函数(响应){
//当请求成功处理时,请执行某些操作
});
//如果你提交一份表格
$.post('url',{$(“#formId.serialize())},函数(响应){
//当请求成功处理时,请执行某些操作
});
u可以使用poster调用该函数并设置参数。。