I added the data to the list , and return it as JSON in my controller :
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);
iii
iii
I traced it in firebug ready, the JSON works well. The problem :
proValByDep.BrandImage is undefined.
任何解决办法请见。 非常感谢。