Sult

Untitled

May 11th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.31 KB | None | 0 0
  1. $.getJSON( "{% url 'characters:sheet_json' %}", function(obj) {
  2.         refresh_timer = obj.refresh_timer * 1000;
  3.         setTimeout(refresher, refresh_timer);
  4.  
  5.         if (obj.content) {
  6.             // do shit with content and data
  7.             var source   = $("#SheetTemplate").html();
  8.             var template = Handlebars.compile(source);
  9.             var context = obj.content;
  10.             var html    = template(context);
  11.             $("#SheetContent").replaceWith(html);
  12.  
  13.         }
  14.     });
  15.   };
  16.  
  17.  
  18.  
  19. Mijn json object:
  20. {"content": {"charactername": "John Barra", "portrait_url": "/media/images/characters/93252880_200.jpg", "skillpoints": 11561858, "bloodline": "Civire", "corporationdate": "2013-10-16T09:53:00Z", "lastlocation": "X-4WZD", "race": "Caldari", "securitystatus": 0.767783748266338, "corporation": "Dry Atomic Fusion", "alliance": "Apocalypse Now.", "balance": 4799014.4, "history": [{"corporation": "Dry Atomic Fusion", "startdate": "2013-10-16T09:53:00Z"}, {"corporation": "Caldari Provisions", "startdate": "2013-10-15T19:19:00Z"}, {"corporation": "Dry Atomic Fusion", "startdate": "2013-09-27T17:00:00Z"}, {"corporation": "School of Applied Knowledge", "startdate": "2013-04-24T12:43:00Z"}]}, "refresh_timer": 300}
  21.  
  22. als ik nu  {{ charactername }} in mijn template gebruik dan werkt het niet.  wat mis ik?
Advertisement
Add Comment
Please, Sign In to add comment