参考:
http://kb.cnblogs.com/a/1510504/ asp.net 3.5
http://www.cnblogs.com/hunts/archive/2006/11/20/566694.aspx 第三方
jquery json 兼容各种语言
function loginin(){
$.blockUI({message:"<div style='padding:10px 0'>正在提交请求,请稍候...</div>"});
var username = $.trim($("#account_name").val());
var pasw = $.trim($("#password").val());
var remoteUrl = "login.aspx?username=" + username + "&password=" + encodeURIComponent(pasw) + "&t=" + (new Date()).getTime();
$.getJSON(remoteUrl,function(data){
if (data.sucess != "True"){
if(data.message)
location.href = "message.aspx?e=" + data.message ;
}else{
location.href="main.aspx";
}
})
获得JSON串(序列化):JsonConvert.SerializeObject(类的实例);
获得实例(反序列化):类名 cre = (类名)JsonConvert.DeserializeObject(str, typeof(类名));
str为第一步获得的结果值。
前提是引用Newtonsoft.Json.Net20.dll,命名空间using Newtonsoft.Json;