我收到了启用CORS的网络服务的回复。响应似乎回来了很好,除了在提琴手它说它被编码的事实。我点击小选项进行解码,我看到json对象很好。
然而,使请求的ajax()调用对响应没有任何作用。我将dataType指定为' json'但我不认为成功的回调就像它收到的数据响应一样。有任何已知问题吗?这是我的ajax调用(我在JIRA插件的速度模板中执行此操作,因此请不要介意' AJS。$。'标记:
AJS.$.ajax({
url: apiURL + 'WebAPI/api/Submissions' + '?filenumber=' + file + '&idnumber=' + id+ '&gamename=' + game,
type: 'GET',
dataType: 'json',
success: function(data)
{
AJS.$('#noSearchCriteriaDiv').css('display', 'none');
AJS.$('#progressBar').css('display', 'none');
if(data.length == 0)
{
AJS.$('#noResultsDiv').fadeIn(1600);
}
else
{
AJS.$('#subResults tbody tr').remove();
AJS.$.each(data, function (key, component) {
AJS.$('#subResults tbody:last').append(formatComponent(component));
});
AJS.$('#subResultsDiv').fadeIn(1600);
}
},
error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert('status:' + status);
alert('error:' + error);
alert('xhr:' + xhr.responseText);
}
})
以下是响应标题:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
Access-Control-Allow-Origin: *
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Origin,Content-Type
Access-Control-Allow-Methods: *
Date: Sat, 29 Mar 2014 12:37:23 GMT