errorThrown:{0}
', errorThrown));
options.error(textStatus, errorThrown);
}
});
};
$('body').on('click', 'button', function () {
var $input = $(this).parent().prev();
var options = $.extend(JSON.parse($input.attr('data-val')), { data: JSON.parse($input.val()) }, { test: true, div: $(this).parent().parent().next() });
ajax(options);
});
// 接口调用
ajax({
title: '用户登陆调用接口',
anonymous: true,
url: '../api/login', method: 'POST', data: { userName: 'Test', password: '1' }, success: function (result) {
var token = result.Token;
ajax({
title: '用户登陆信息接口', url: '../api/login', headers: { Token: token },
method: 'GET'
});
ajax({
title: '指定用户信息接口', url: '../api/Users', headers: { Token: token },
method: 'GET', data: { userName: "Test" }
});
ajax({
title: '检查当前用户名是否可用接口', url: '../api/Users', headers: { Token: token },
method: 'PUT', data: { UserName: "101", UserStatus: 9 }
});
ajax({
title: '更改用户显示名称接口', url: '../api/Users', headers: { Token: token },
method: 'PUT', data: { UserName: "101", UserStatus: 1, DisplayName: "1010" }
});
ajax({
title: '更改用户密码接口', url: '../api/Users', headers: { Token: token },
method: 'PUT', data: { UserName: "101", UserStatus: 2, Password: "1", NewPassword: "2" }
});
ajax({
title: '新建用户接口', url: '../api/Users', headers: { Token: token },
method: 'POST', data: { ID: 0, UserName: "102", Password: "1", DisplayName: "102" }
});
ajax({
title: '更新用户接口', url: '../api/Users', headers: { Token: token },
method: 'POST', data: { ID: 21, UserName: "102", Password: "1", DisplayName: "102" }
});
ajax({
title: '删除用户接口', url: '../api/Users', headers: { Token: token },
method: 'DELETE', data: { "": "50,51" }
});
}
});
});