将json响应绑定到标签

时间:2014-11-03 12:32:44

标签: ajax json

  public JsonResult GetPrice(List<int> modelValues)
    {
        List<int> model = new List<int>();
        try
        {foreach(var d in modelValues)
           model.Add(d); 
        }


        return Json(model, JsonRequestBehavior.AllowGet);
    }

function GetDetail(){     var jsonUrl = Home / GetPrice“;

$.ajax({
    cache: false,
    url: jsonUrl,
    type: "POST",
    data: "{}",
    contentType: "application/json",
    dataType: 'json',
    async: true,
    success: function (data) {

    },
    error: function (x, t, m) {

    }
});

我希望模型中显示的值显示在label中。它应该通过使用ajax调用绑定数据来完成。有人可以建议我一个解决方案吗?标签id = html文件中的“名称”。

0 个答案:

没有答案