我试图得到一个表中MVC3使用AJAX动态加载。 为什么在兼容模式在IE9这只是工作的? 是否有办法解决它?
视图:
<script src="../../Scripts/jquery-1.5.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.11.js" type="text/javascript"></script>
<script type="text/javascript">
$.ajax({
type: 'POST',
url: "/Index/GetApplicationsForUserJSON",
success: function (data) {
for (var i = 0; i < data.length; i++) {
$("#ApplicationsForUser tbody").append("<tr>" +
"<td>" + data[i].Application + "</td>" +
"<td>" + data[i].Roles + "</td>" +
"</tr>");
}
$("tr:odd").css({ 'backgroundColor': '#ebf0f5' });
}
});
</script>
<table id="ApplicationsForUser" class="ui-widget ui-widget-content" style="width: 99%;
margin: 3px 0px 0px 3px">
<thead>
<tr class="ui-widget-header ">
<th style="width: 45%">
Application
</th>
<th style="width: 45%">
Roles
</th>
</tr>
</thead>
</table>
控制器:
public JsonResult GetApplicationsForUserJSON()
{
Dictionary<string, string> tableData = new Dictionary<string, string>();
tableData.Add("row1", "row1data");
var jsonData = tableData
.Select(c => new
{
Application = c.Key,
Roles = c.Value
});
return Json(jsonData, JsonRequestBehavior.AllowGet);
}
编辑:图片!