asp.net mvc - MVC 5 view not autoupdating partial view -


i have controller

public class accountdetailscontroller : controller {     private readonly iaccountstatsrepository _accountstatsrepository;      public accountdetailscontroller(iaccountstatsrepository accountstatsrepository)     {         _accountstatsrepository = accountstatsrepository;     }      public actionresult details(string accountemail)     {         var stats = _accountstatsrepository.get(accountemail);          var accountdetailsviewmodel = new accountdetailsviewmodel         {             email = accountemail,             money = stats.totalcredits         };          return view(accountdetailsviewmodel);     }      [outputcache(nostore = true, location = outputcachelocation.client, duration = 3)] // every 3 sec     public actionresult getlatestlogging(string email)     {         //if (email == null || email != null)         //{             var list = new list<logviewmodel>();              return partialview("latestloggingview", list);         //}      } } 

and view

@using futwebfrontend.viewmodels @model accountdetailsviewmodel  @{     viewbag.title = "details"; }  <h2>@model.email</h2>  <div>     <h4>account details</h4>     money @string.format("{0:0,0}", model.money)   </div>  <div id="loggingstream">     @html.partial("latestloggingview", new list<logviewmodel>()) </div>  <hr /> <dl class="dl-horizontal"></dl> <p>     @html.actionlink("back list", "index", "accountcontrol") </p>  <script type="text/javascript">      $(function() {         setinterval(function () { $('#loggingstream').load('/accountdetails/getlatestlogging/@model.email'); }, 3000);     });  </script> 

but when go page , put breakpoint in getlatestlogging nothing happens if hit f12 in chrome "uncaught referenceerror: $ not defined "details:67

from can gather, should hit method every 3 seconds, must have made simple error somewhere

try this

$( document ).ready(function() { setinterval(function () {$('#loggingstream').load('/accountdetails/getlatestlogging/@model.email'); }, 3000); }); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -