问题
I am trying to understand how I can bind data from a remote datasource to a form, similar to this question, my ajax is returning the correct data.
I have tried to implement the suggested solution but it doesn't appear to work and there are no errors either.
my ajax request:
$.ajax({
url: "Read?messageID=" + "123456",
method: "get",
type: "application/json",
success: function (result) {
console.log(result);
},
error: function (result) {
console.log(result);
}
})
I do not know how to extract the response from the read data and display it in my simple form.
If anyone could kindly give me some pointers, I would be so grateful. I have read a lot of posts on both SO and the Telerik forums but I have not been able to understand how to overcome my problem.
Many thanks
Edit:
This is my form field:
@Html.Label("message", "Note:", new { @class = "form-label" })
<input id="messages" class="form-control k-textbox" data-bind="value:message" />
Do I need to add a viewModel?
回答1:
For kendo Datasource here is a sample
$.ajax({
url: "Read?messageID=" + "123456",
method: "get",
type: "application/json",
success: function (result) {
var dataSource = new kendo.data.DataSource({
data: result
});
console.log(result);
},
error: function (result) {
console.log(result);
}
});
来源:https://stackoverflow.com/questions/57939525/kendo-bind-remote-datesource-to-form