public ActionResult GetManufacturers()
{
string restURL = "https://xxx.xxx.xxx";
using (var client = new WebClient())
{
var data = client.DownloadString(restURL);
return Content(data, "application/json");
}
}
<pre class="prettyprint"></pre>
前端在用jquery getjson調用
取得Action HomeContraller 裡的GetManufacturers 然後用each 抓data.items[i].id每個id得值
在來就看你想怎做了
$.getJSON("@Url.Action("GetManufacturers", "Home")", function (data) { $.each(data.items , function(i,item){ var Id = data.items[i].id; console.log ("Id:",Id) }); });
沒有留言:
張貼留言