Ajax1
一Ajax基本结构
$.ajax({ url: "ashxs/message.ashx",//操作数据库页面路径 data: {},//传输数据 type: "post",//传输方式 dataType: "json",//返回类型 success: function (result) { }//success函数 });
返回单个json
result = "{\"user\":\"" + text.name + "\",\"folk\":\"" + text.nation.name + "\",\"birth\":\"" + text.Birthday + "\",\"sex\":\"" + text.Sex + "\"}";
返回多个json
result = "[{\"user\":\"" + text.name + "\",\"folk\":\"" + text.nation.name + "\",\"birth\":\"" + text.Birthday + "\",\"sex\":\"" + text.Sex + "\"},{\"user\":\"" + text.name + "\",\"folk\":\"" + text.nation.name + "\",\"birth\":\"" + text.Birthday + "\",\"sex\":\"" + text.Sex + "\"},....]";