使用 JIRA REST 请求 Jsonp 时出错 API
Error when requesting a Jsonp using JIRA REST API
我做了这个函数来从 JIRA 请求一些票证,我将数据类型指定为 jsonp 以避免跨源问题,当我发出请求时,我在浏览器调试器中得到了响应,但是无法处理 json 响应 "SyntaxError: missing ; before statement" ,如果我发送 jsonp 的请求,有什么方法可以读取 json 吗?
var ajaxUrl = jira/rest/api...
jQuery.ajax({
url:ajaxUrl,
dataType: 'jsonp',
jsonpCallback: 'callback',
type : "GET",
beforeSend: function (xhr){
success: function w(data){
console.log(data);
alert('Sucess data: ' + data);
};
error: function e(data){alert('alert error');}
}
})
我解决了这个问题,我更改了 json 中的 jsonp,然后我从 jira 服务器重新制作了 corss,这里是如何解释的:https://community.atlassian.com/t5/Answers-Developer-Questions/Enable-CORS-in-JIRA-REST-API/qaq-p/553997,它看起来像问题出在预检部分。
我做了这个函数来从 JIRA 请求一些票证,我将数据类型指定为 jsonp 以避免跨源问题,当我发出请求时,我在浏览器调试器中得到了响应,但是无法处理 json 响应 "SyntaxError: missing ; before statement" ,如果我发送 jsonp 的请求,有什么方法可以读取 json 吗?
var ajaxUrl = jira/rest/api...
jQuery.ajax({
url:ajaxUrl,
dataType: 'jsonp',
jsonpCallback: 'callback',
type : "GET",
beforeSend: function (xhr){
success: function w(data){
console.log(data);
alert('Sucess data: ' + data);
};
error: function e(data){alert('alert error');}
}
})
我解决了这个问题,我更改了 json 中的 jsonp,然后我从 jira 服务器重新制作了 corss,这里是如何解释的:https://community.atlassian.com/t5/Answers-Developer-Questions/Enable-CORS-in-JIRA-REST-API/qaq-p/553997,它看起来像问题出在预检部分。