2013-10-19 59 views
0

新的淘汰赛,新的Js,我是一个点网开发人员,试图创建一个淘汰赛登录屏幕,发布数据罚款,接收回应好,只是无法弄清楚如何更新单个观察的,请帮助...KnockoutJs更新视图模型从JSON webservice的单观察

function AppViewModel() { 
this.email = ko.observable("Bergmail.com"); 
this.password = ko.observable("Password"); 
this.logonresult = ko.observable("logon resul"); 
//computed 
this.Computedresult = ko.computed(function() { 
    return this.email() + " " + this.password(); 
}, this); 
    //behavious 
this.Loginajax = function() { 

    var self=this 
    $.ajax("Indi-Dal-Json.asmx/CheckLogon" ,{ 
     data: ko.toJSON({ email: this.email,password: this.password}), 
     type: "post", contentType: "application/json", 
     success: function (ajaxjsondata) { 
      { 
       // var parsedjson = JSON.parse(result.b); 
       //AppViewModel.logonresult = (result.d); 
       self.logonresult = ajaxjsondata.d; 
      } 

     } 
    }); 
    }; 
} 
+0

ajaxjsondata.d可以是真或假或未找到,我试图更新this.logonresult,然后更新视图模型的视图... Thx寻找 – saj

回答