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 + "\"},....]";

 

posted on 2016-08-14 21:38  bosamvs  阅读(126)  评论(0编辑  收藏  举报

导航