在javascript中使用正文和标题发布请求

编程入门 行业动态 更新时间:2024-10-27 20:24:18
本文介绍了在javascript中使用正文和标题发布请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好我的帖子请求

hi i have post request

function GetTokenfromGrap(resource, obj, failureCallback) { debugger; var deffered = $q.defer(); resource = '/xxxxx/oauth2/token' var url = baseUrl + resource; var configurations = { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, } $http.post(url, obj, configurations).then(deffered.resolve).catch(function (data) { handleCatch(data); if (typeof failureCallback === 'function') failureCallback(data); }); return deffered.promise; }

i想要为此添加身体请求,我该怎么办 我尝试过: i googled它但我没有得到任何解决方案

i want to add body to this request , how can i do this What I have tried: i googled it but i didn't get any solution

推荐答案

q.defer(); resource ='/ xxxxxx/oauth2/token' var url = baseUrl + resource; var configurations = { headers:{'Content-Type':'application / x-www-form-urlencoded'},} q.defer(); resource = '/xxxxx/oauth2/token' var url = baseUrl + resource; var configurations = { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, }

http.post(url,obj,configurations).then(deffered.resolve).catch(function(data){ handleCatch(data); if(typeof failureCallback ===' function')failureCallback(data); }); return deffered.promise; } http.post(url, obj, configurations).then(deffered.resolve).catch(function (data) { handleCatch(data); if (typeof failureCallback === 'function') failureCallback(data); }); return deffered.promise; }

i想要为此添加身体请求,我该怎么办 我尝试过: i搜索它但我没有得到任何解决方案

i want to add body to this request , how can i do this What I have tried: i googled it but i didn't get any solution

obj是正文。

更多推荐

在javascript中使用正文和标题发布请求

本文发布于:2023-10-29 09:31:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539343.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标题   正文   javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!