Advertisement
orksnork

Untitled

Aug 25th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.79 KB | None | 0 0
  1. executiveOverviewBuild: function() {
  2.  
  3.         $.ajax({
  4.             url: "/accounts/feed/",
  5.             async: true,
  6.             dataType: 'json',
  7.             success: function(data) {
  8.                 buildAccounts.allAccounts = data;
  9.                 $("#main_wrapper").append("<h2 class='text-center announce'>Client Executive Overview - Contract to Date</h2><div class='row'><div class='col-xs-12' id='exec_charts'></div>"
  10.                 );
  11.                 _.each(data, function(account) {
  12.                     $.ajax({
  13.                         url: "/accounts/feed/" + account.account_id,
  14.                         async: true,
  15.                         dataType: 'json',
  16.                         success: function(data2) {
  17.                             buildAccounts.currentAccount = data2;
  18.                             buildAccounts.theMain = data2;
  19.                             buildAccounts.mrr = buildAccounts.currentAccount.asset_value;
  20.                             /*here*/
  21.                             console.log(buildAccounts.currentAccount);
  22.                         }
  23.                     }).then(function() {
  24.                         $.ajax({
  25.                             url: "/test/feed/" + buildAccounts.currentAccount.account_id + "/",
  26.                             async: true,
  27.                             dataType: 'json',
  28.                             success: function(data3) {
  29.                                 /*here*/
  30.                                 console.log(buildAccounts.currentAccount);
  31.                                 buildAccounts.accountOldestTicket = data3.oldest_ticket.substring(
  32.                                     4, 15);
  33.                                 buildAccounts.totalHours = data3.total_hours.toString().substr(
  34.                                     0, 6);
  35.                             }
  36.                         });
  37.                     }).then(function() {
  38.                         $.ajax({
  39.                             url: "/test/feed/udf/" + buildAccounts.currentAccount.account_id +
  40.                                 "/",
  41.                             async: true,
  42.                             dataType: 'json',
  43.                             success: function(data4) {
  44.                                 buildAccounts.udfs = data4;
  45.                                 buildAccounts.myChartNumber++;
  46.                                 $("#exec_charts").append("<canvas id='" + buildAccounts.myChartNumber +
  47.                                     "' width='350' height='350' class=''></canvas>");
  48.                                
  49.                             }
  50.                         }).then(function() {
  51.                             buildAccounts.createChart();
  52.                         });
  53.  
  54.                     });
  55.                 });
  56.             }
  57.         });
  58.  
  59.  
  60.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement