Advertisement
Guest User

JS Request

a guest
Sep 8th, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getAmoCallerData(mess, callback) {
  2.             var text = '',
  3.                 dataS = {};
  4.  
  5.             $.get('//' + window.location.host + '/private/api/contact_search.php?SEARCH=' + mess.calleridnum,
  6.  
  7.                 function(res) {
  8.  
  9.                     dataS.id = $(res).find('contact > id').eq(0).text();
  10.                     dataS.name = $(res).find('contact > name').eq(0).text();
  11.                     dataS.company = $(res).find('contact > company > name').eq(0).text();
  12.  
  13.                     callback(dataS, mess);
  14.  
  15.                     if (dataS.id == '') {
  16.                         console.log('1');
  17.                         text = 'Вам звонит новый клиент ' + mess.calleridnum + '<br><a href="/contacts/add/?phone=' + mess.calleridnum + '" class="js-navigate-link notification-call-link">Добавить контакт</a>';
  18.                     } else if (dataS.company == '') {
  19.                         console.log('2');
  20.                         text = 'Вам звонит ' + dataS.name + '<br><a href="/contacts/detail/?phone=' + mess.calleridnum + '" class="js-navigate-link notification-call-link">Открыть контакт</a>';
  21.                     } else {
  22.                         console.log('3');
  23.                         text = 'Вам звонит ' + dataS.name + '<br>из компании ' + dataS.company + '<br><a href="/contacts/detail/?phone=' + mess.calleridnum + '" class="js-navigate-link notification-call-link">Открыть контакт</a>'
  24.                     }
  25.  
  26.                     // console.log(status);
  27.  
  28.                 })
  29.  
  30.  
  31.  
  32.  
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement