我添加的數據列表asp.net的MVC的視圖JSON結果,並在我的控制器返回它的JSON:不能循環中
List<ProductListingModels> prom = new List<ProductListingModels>();
ProductListingModels product = new ProductListingModels();
foreach (var item in ien_item)
{
if ((item.Brand.IsAuthorized == true) && ((HelperClass.ICEContact.PathBrandImages +
item.Brand.Image) != null))
{
product.BrandImage = HelperClass.CheckImageUrlExist(item.Brand.Image);
}
else
{
product.BrandImage = " ";
}
}
prom.Add(product);
return Json(new
{
ja = prom.ToList()
}, JsonRequestBehavior.AllowGet);
這是我的看法:
$.getJSON("ProductListing/Index", data, function (product) {
$.each(data, function (index, proValByDep) {
alert(proValByDep.BrandImage);
});
});
我在firebug準備好了它,JSON效果很好。 問題:
proValByDep.BrandImage is undefined.
任何解決方案,請。非常感謝。
show wh json – Mediator 2012-04-25 08:25:47
'{「ja」:[{「BrandImage」:「http:// pd:8080/Product/Brand/28.PNG」}]}' – Nothing 2012-04-25 08:32:26