0
我在API控制器,這條路叫Recruiting
:asp.net網頁API 2屬性路徑沒有找到
ResponseType(typeof (int))]
[Route("Recruiting/setprimary/")]
public async Task<IHttpActionResult> PutUpdatePrimary(string userId, string orgId)
{
return Ok();
}
我試圖通過AJAX來打這個路由像這樣:
self.updatePrimary = function() {
var orgKey = self.selectedOrgKey();
alert(orgKey);
$.ajax({
type: "PUT",
contentType: "application/json; charset=utf-8",
url: "/Recruiting/setprimary/" + "?userId=" + userId + "&?orgId=" + orgKey,
data: null,
dataType: "json",
success: function (data) {
bootbox.alert('Changes saved successfully.');
},
error: function (err) {
bootbox.alert('An error occured while trying to set primary organisation. Please try again :/');
}
});
return true;
};
提琴手說它找不到路線。我在這裏有什麼錯誤?
當你觀看網絡流量在你的開發工具是什麼完整的URI,當您試圖打的行動? –