How to access asp.net mvc property in javascript method? using AJAX Request
i have a property Model.Feeds
i would like to add value to Feeds
in javascript metod:
function DataRetrieved(data) {
'<%=Model.Feeds %>' = data;
}
'<%=Model.Feeds %>'
not works because its will be recognized as string开发者_如何学Python.
please help how to access property of model.
The Model property is a server-side property. JavaScript runs on the client side. Thus, you cannot assign a value to your Model by using JavaScript. You have to set Model properties server-side.
Why are you trying to set a Model value within JavaScript? There might be another way to look at the problem, in order to come up with a solution.
精彩评论