我试图连接我在JS下面使用的TFS-2015 (kerberos身份验证),但它没有工作:(
$.ajax({
url:
"https://<server>/<collection>/_apis/wit/workitems/api-version=3.0",
type: 'GET',
crossDomain: true,
dataType: 'json',
xhrFields: {
withCredentials: true
}
}).done(function(data){
console.log('done');
console.log(data);
}).fail(function(jqXHR,textStatus ,errorThrown){
console.log('error'); console.log(errorThrown);
});有人能帮我吗?
发布于 2017-05-17 03:23:12
您的代码没有问题,它适用于。如果您看到有关铬的任何问题,请查看此链接以获得详细信息:带有Kerberos身份验证的jQuery ajax请求。
<script>
$(document).ready(function () {
var query = { "query": "Select [System.Id] from WorkItems Where [System.TeamProject] = 'TeamProjectName' AND [System.WorkItemType] = 'Bug'" };
$.ajax({
url: "http://tfsserver/collectionname/_apis/wit/wiql?api-version=1.0",
type: 'Post',
contentType: 'application/json',
dataType: "json",
data: JSON.stringify(query),
xhrFields: {
withCredentials: true
}
}).done(function(data){
alert('done');
alert(JSON.stringify(data));
}).fail(function(jqXHR,textStatus ,errorThrown){
alert('error');
alert(errorThrown);
});
});
</script>发布于 2017-05-17 08:16:33
$(document).ready(function () {
var d = { "query": "Select [System.Id] from WorkItem
Where [System.TeamProject] = '@MR' AND
[System.WorkItemType] = 'Defect'" };
$.ajax({
type: 'GET',
url: "https://<server>/tfs/<collection>",
cache: false,
async: true,
xhrFields: {
withCredentials: true
},
contentType: 'application/json',
data: JSON.stringify(d),
success: function (data) {
console.log(data);
alert('POSTED SUCCESSFULLY TO THE SERVER');
},
error: function (msg, url, line) {
alert(msg);
alert(url);
alert(line);
}
});
});@Eddie感谢您的回答我使用了这个代码,但我不确定,因为它给了我一个HTML IE中的响应您知道这是什么
https://stackoverflow.com/questions/43932906
复制相似问题