Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function User( username, date_inactive, date_active ) {
- this.username = username;
- this.date_active = date_active;
- this.date_inactive = date_inactive;
- };
- User.prototype.inactivateMe = function() {
- json_responses.push( this );
- $.getJSON( "url" + this.username, function( json ) {
- original = json_response.pop();
- //do update here
- });
- };
- userModel = [ ], //Where the loaded usernames are stored.
- viewUserModel = {
- users: ko.observableArray(userModel)
- //.......
- //This is how I'm adding users to the array.
- addUser: function () {
- $.getJSON( "url",
- { username: usern },
- function( json ) {
- if( json.STATUS != undefined && json.STATUS == 'success' ) {
- newuser = new User( json.USERNAME, json.DATE_ACTIVE, json.DATE_INACTIVE );
- viewUserModel.users.push( newuser );
- }
- }
- });
- }
- function User( username, date_inactive, date_active ) {
- this.username = username;
- this.date_active = ko.observable(date_active);
- this.date_inactive = ko.observable(date_inactive);
- };
- <div data-bind="foreach: Users">
- <input data-bind="value: date_active"/>
- <input data-bind="value: date_inactive"/>
- <div>
Add Comment
Please, Sign In to add comment