Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Knockout View Model Method Call with deferreds
var viewModel = function() {
var self = this;
self.description = ko.observable();
self.get = function(words) {
return $.ajax({
url: "/echo/json",
dataType: "json",
type: "POST",
data: {
"text": words
success: function(data) {
error: function(data) {
$(function() {
var instance = new viewModel();
$.when(instance.get('something')).then(function() {
instance.description('post promise');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.