【发布时间】:2015-03-05 03:46:36
【问题描述】:
通过 AJAX 和 REST API 添加问题并不走运。我可以让它与 Postmen 一起工作,不幸的是,无法通过 Ajax 请求获得它。
我创建的 JSON 很好,post 请求也很好。问题类型是我自己创建的,使用 Bug 给出了同样的问题。查看创建的 JSON 对象、我的错误和我的代码: JSON 对象(这是来自 console.log 的 sn-p):
错误
0: "无法识别的标记 'fils5poet5': 期待 'null', 'true', 'false' 或 NaN↵ 在 [来源: org.apache.catalina.connector.CoyoteInputStream@7b958ed2;线:1, 列:21]"
jira = {
fields : {
project : {
key : "CIC"
},
summary : "test",
description: "test",
issuetype : {
name : "Sandbox item"
}
}
};
console.log(jira); //Also see image at top of this post.
// Submit to Jira api
$.ajax({
type : "POST",
dataType : "JSON",
url : configuration.api_url,
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic ItsAWrap!(itworks...)"),
xhr.setRequestHeader ("Content-Type", "application/json");
},
data : jira,
success : (function(response) {
//Do something
}})
【问题讨论】:
标签: ajax json rest jira jira-rest-api