Created
August 21, 2012 03:50
-
-
Save igormoochnick/3411363 to your computer and use it in GitHub Desktop.
jinx - using generated data models with the REST service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.registerOnServer = function () { | |
$.post("/api/ToDo", getDataModel()); | |
}; | |
this.removeFromServer = function () { | |
$.ajax({ | |
type: "DELETE", | |
url: "/api/ToDo/" + self.guid | |
}); | |
}; | |
this.updateOnServer = function() { | |
$.ajax({ | |
type: "PUT", | |
url: "/api/ToDo/" + self.guid, | |
data: getDataModel() | |
}); | |
}; | |
function getDataModel() { | |
var item = new ToDoItem(); | |
item.guid = self.guid; | |
item.title = self.title(); | |
item.completed = self.completed(); | |
return item; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment