当对控制器方法进行ajax调用时,我得到空值。我是淘汰赛的新手,感谢你们对这些问题的帮助。我将此js代码放在外部文件中,并在按钮单击时调用loginmethod函数。根据要求没有表格标签。
我如何在下面的片段中包含淘汰赛的无障碍验证?
var ViewModel = function () {
//Make the self as 'this' reference
var self = this;
//Declare observable which will be bind with UI
self.UserName = ko.observable("");
self.Password = ko.observable("");
self.RememberMe = ko.observable(false);
self.ReturnUrl = ko.observable("");
//The Object which stored data entered in the observables
var CustData = {
UserName: self.UserName,
Password: self.Password,
RememberMe: self.RememberMe,
ReturnUrl : self.ReturnUrl,
};
//Declare an ObservableArray for Storing the JSON Response
self.LoginMethod = function () {
//Ajax call to Insert the Customer record
$.ajax({
type: "POST",
url: "http://localhost:8089/Home/SignIn/",
data: ko.toJSON(CustData), //Convert the Observable Data into JSON
success: function (data) {
console.log("success");
},
error: function (data) {
console.log("failed");
console.log("data");
}
});
//Ends Here
};
};
ko.applyBindings(new ViewModel());