Advertisement
Guest User

Untitled

a guest
May 26th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var timer = {};
  2.  
  3. function pdf_loop_check(loan_id){
  4.  
  5.         timer[loan_id] = setInterval(function(){
  6.  
  7.             pdf_statusChecker(loan_id);
  8.         }, 10000);
  9.        
  10. }
  11. function pdf_statusChecker(loan_id) {
  12.     $.ajax({
  13.         type: "GET",
  14.         url: "/hellosign/checkloanstatus/" + loan_id,
  15.         dataType: "json",
  16.         async: true,
  17.         success: function (data) {
  18.      
  19.             if ((data.status == 'electronic_sign_complete' && data.coborrower == false) || (data.status == 'electronic_sign_waiting_co_borrower' && data.coborrower == true)) {
  20.  
  21.                 console.log('pdf done');
  22.                 $('#generating_pdf_' + loan_id).html('<a href="/download_pdf/' + loan_id +'" target="_blank"><i class="fa fa-floppy-o"></i> Download PDF</a>');
  23.  
  24.                 clearInterval(timer[loan_id]);
  25.  
  26.             }
  27.         },
  28.         error: function (data) {
  29.             console.log('ajax for ' + loan_id +'finish errors.');
  30.             console.log(data);
  31.         }
  32.     });
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement