老老鼠

博客园 首页 新随笔 联系 订阅 管理

页面调用部分:

$('#btn').click(function () {
    $.ajax({
        type: 'post',
        url: './GridTable.aspx/call',
        contentType: "application/json; charset=utf-8",
        data: '{"userinfo":[{"name":"zs","age":"21"},{"name":"ls","age":"25"}]}',
        dataType: 'json',
        success: function (result) {
            alert(result.d);
        }
    });

    return false;
});

后台调用部分,两种方法均可
[WebMethod]
public static string call(Dictionary<string,string>[] userinfo)
{
    System.Threading.Thread.Sleep(5000);
    return str[0]["name"];
}

[WebMethod]
public static string test(List<UserinfoEntity> userinfos) {
    System.Threading.Thread.Sleep(5000);
    foreach (UserinfoEntity userinfo in userinfos) {
        return order.rowid;
    }

    return "什么也没有";
}

posted on 2010-08-14 10:33  大老鼠  阅读(29978)  评论(0编辑  收藏  举报