MVC 随记

2014-09-04

[1] Json

var contact = new Object();
contact.firstname = "Jesper";
contact.surname = "Aaberg";
contact.phone = ["555-0100", "555-0120"];

var memberfilter = new Array();
memberfilter[0] = "surname";
memberfilter[1] = "phone";
var jsonText = JSON.stringify(contact, memberfilter, "\t");
document.write(jsonText);

JSON.stringify IE8、IE9不兼容,解决方法


[2] popup

 

$.ajaxSetup({ cache: false });

$(document).ready(function () {
$(".openDialog").live("click", function (e) {
e.preventDefault();

$("<div></div>")
.addClass("dialog")
.attr("id", $(this)
.attr("data-dialog-id"))
.appendTo("body")
.dialog({
title: $(this).attr("data-dialog-title"),
close: function () { $(this).remove(); },
modal: true,
height: 250,
width: 400,
left: 0

})
.load(this.href);
});

$(".close").live("click", function (e) {
e.preventDefault();
$(this).closest(".dialog").dialog("close");
});
});

-------------------------------------

<%: Html.ActionLink("Detail~~", "Detail",
new { code=item.Name },
new { @class = "openDialog", data_dialog_id = "aboutlDialog", data_dialog_title = "About Us"}
)%>

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。