data binding - ASP.Net MVC page refresh using json values instead of html -
data binding - ASP.Net MVC page refresh using json values instead of html -
i have page has "prev" , "next" day button, , rather reload entire page, ajax phone call controller returns entire partial view, replace div with.
$("#divid").html(ajaxresponse);
pretty simple.
however, i'm finding partial view vastly more info need (html doesn't alter @ all, data) , it's causing slowness on mobile browsers.
my question is, there tool out there allow me homecoming json representation of model info , refresh values on page automatically?
for example, have:
@html.inputfor(x => x.firstname)
and json returns
{ firstname: 'henry', lastname: 'mcleery' }
is there library available can automate process of doing:
$("#firstname").val(ajaxresponse.firstname); $("#lastname").val(ajaxresponse.lastname); etc...
?
take @ angular.js. angular javascript framework uses mvc pattern. after binding ui elements model displayed info changes automatically when updating model. angular offers nice api consume ajax requests json data. @ this: get , update json using angular.js
json data-binding asp.net-mvc-5
Comments
Post a Comment