开发者

How to access asp.net mvc property in javascript method? using AJAX Request

开发者 https://www.devze.com 2023-02-05 06:52 出处:网络
i have a property Model.Feeds i would like to add value to Feeds in javascript metod: function DataRetrieved(data) {

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号