JQuery------$.getJSON()方法的使用

html(../Home/Index.cshtml)

<body>
<button class="Btn">按钮</button>
</body>

js

$(document).ready(function () {
$(".Btn").click(function () {
$.getJSON("../Home/Index",function (data) {
for (var i = ; i < data.length; i++) {
var obj = data[i];
alert(obj);
}
});
});

HomeController

public ActionResult Index(string url)
{
  ArrayList list = new ArrayList() {"","","" };
  return Json(list,JsonRequestBehavior.AllowGet); ;
}
上一篇:HDU 3775 Chain Code ——(Pick定理)


下一篇:c# http请求添加cookie