ノックアウトでajaxリクエストを行うためのヘルプが必要です。これが私のjsコードで、webmethodを呼び出します。
// Client-side routes
Sammy(function () {
this.get('#:day', function() {
self.choosenDateId(this.params.day);
$.ajax({
type: "POST",
url: 'SinglePageApp.aspx/GetData',
data: "{goalDate:'" + this.params.days + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
debugger;
self.choosenDateGoal(msg.d);
alert("success");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
alert(errorThrown);
}
})
});
}).run();
そして、データをバインドするための私のhtml
<tbody data-bind="foreach: GetData">
<tr data-bind="click: $root.goToGoal">
<td data-bind="text: status"></td>
<td data-bind="text: data"></td>
<td data-bind="text: notes"></td>
</tr>
</tbody>
そして、私のwebemthodでは、パラメーターとして1日を過ぎましたが、webmethodを呼び出すことはできません。助けてください。