阅读背景:

如何将JSON数据转换为类对象

来源:互联网 

JS Code.

// this is person class constructor.
function personClass(id, name, address, phone) {
    this.Id = id;
    this.Name = name;
    this.Address = address;
    this.Phone = phone;
}
var person = new Array();
person.push(new personClass("101", $('#txtName').val(), $('#txtAddress').val(), $('#txtPhone').val());

AjaxRequest = function ("PersonInfo.asmx/AddNewPerson", "{'person[]':'" + JSON.stringify(person) + "'}", successcallback, errorcallback) {
    $.ajax({
        type: "POST",
        url: url,
        data: param,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: successcallback,
        error: errorcallback
    });
}
// this is person class constructor.



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: