顾陌 发布时间:2015-01-06 分类:Web 阅读:6024次 5 条评论
ASP.NET使用jQuery Ajax传递json数据,返回接收json的数据。

$.ajax({
    url: "handle.ashx/GetEgg",
    type: "POST",
    dataType: "json",
    async: true,
    data: { id: 16,rid: '111'},
    success: function (res) {
        //debugger;
        res = res[0];
        if (1 == res.success) {
            alert('success');
        }
        else {
            alert('msg:'+res.msg);
        }
    },
    error: function () { alert("出错"); }
});asp.net 处理程序handle.ashx返回json代码:
public string GetEgg()
{
    //返回json的字符串
    return "[{\"success\":\"1\",\"data\":{\"price\":\"88.8\"},\"msg\":\"success\"}]";
}php,jsp同理
发布于 2015-01-10 08:23:02 回复该评论
发布于 2015-01-07 10:27:28 回复该评论
发布于 2015-01-06 18:02:22 回复该评论
发布于 2015-01-06 15:08:26 回复该评论
发布于 2015-01-06 17:18:11 回复该评论
发表评论:
◎欢迎您的参与讨论。