Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. $response = array($query_license,$query_estate,$result_license);
  2. if ($this->request->is('ajax')) {
  3. echo json_encode($response);
  4. die();
  5. }
  6.  
  7. $.ajax({
  8. type: 'GET',
  9. async: true,
  10. cache: false,
  11. url: license,
  12. dataType: 'json',
  13. data:{id_user_license:id_user_license,id_evaluation:id_evaluation},
  14. success: function (data){
  15. $.each(data,function(i,s){
  16. if(s[0].cantidad_pendiente === 0){
  17. $("#message_license").html('<p>Usted no cuenta con licensias disponibles</p>');
  18. $("#modal_report__footer").html('<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancelar</button>');
  19. }else if(s[0].estado === 3){
  20. $("#message_license").html('<p>Usted cuenta con '+ s[0].cantidad_pendiente +'</p>');
  21. $("#message_consumed").html('<p>Esta evaluacion ya consumio licencia</p>');
  22. $("#modal_report__footer").html('<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancelar</button>');
  23. }else{
  24. $("#message_license").html('<p>Usted cuenta con '+ s.indexOf(3).cantidad_pendiente +'</p>');
  25. $("#modal_report__footer").html('<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancelar</button> <button type="submit" class="btn btn-danger">Consumir</button>');
  26. }
  27. });
  28. }
  29. });
  30.  
  31. console.log(s[0].cantidad_pendiente);
  32. 5
  33. undefined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement