asp.net mvc - JQuery Select Element On Changing Partial View -
i have page changing partial view. in main view, how select model property of partial view when updates?
the gist of main page this:
<script ...etc > $(document).ready(function () { $("#renew").click(function () { $("#to-renew").load(...etc); }); }); </script> <div> <input type="button" id="renew" value="renew" /> <div id="to-renew"></div> </div>
the partial view gets "renewed" every click brings new data database, such like:
<div id="to-renew"> @html.hiddenfor(model => model.myproperty) </div>
what need is, each refresh, select new updated property main page, such like:
<script ...etc > $(document).ready(function () { $("#renew").click(function () { $("#to-renew").load(...etc); alert('@model.myproperty'); }); }); </script>
except code ever alert first value, , never new value.
@model.myproperty
rendered when displaying page, never gets renewed after initial load. if div's content being updated correctly, it's content javascript , display:
alert($("#to-renew").html());
or if it's hidden input:
alert($("#to-renew input").val());
Comments
Post a Comment