2013-10-19 91 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

回答