1
$(function() {
$.support.cors = true;
jQuery.support.cors = true;
$.ajax({
crossDomain: true,
type: 'GET',
url: 'http://example.com/WCFRESTService.svc/GetCategories',
success: function(result) {
var s = '';
for (var i = 0; i < result.length; i++) {
s += '<br><a href="@Url.Action("GetAnn", "Home",new { categories_id=result[i]["Categories_id"]})">' + result[i]["Name_Category"] + '</a>';
$('#content').html(s);
}
}
});
});
的Url.Action
上result[i]["Categories_id"]
給出了一個錯誤。
命名爲「結果」不INT當前上下文
如何轉移到我的對象結果存在嗎?
您正在混合c#和js代碼。你需要將href設置爲生成的url - '/ Home/GetAnn?.....' – BenG