Guest User

Untitled

a guest
Feb 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. function Load() {
  2. var cpf;
  3. cpf = sessionStorage.getItem('cpf');
  4.  
  5. jQuery.support.cors = true;
  6.  
  7. // Default options are marked with *
  8. fetch('http://API_AQUI', {
  9. method: 'POST',
  10. headers: {'Content-Type':'application/x-www-form-urlencoded'},
  11. body: `cpf=${cpf}`
  12.  
  13. }).then(response => response.json().then(data => ({
  14. data: data,
  15. status: response.status
  16. })
  17. ).then(res => {
  18. res.data.map(element => {
  19. var text = element;
  20.  
  21. var pegaId = element.ID;
  22. localStorage.setItem('pegaId', pegaId);
  23.  
  24.  
  25.  
  26. $('.produto-1').append(`<div class="col-xs-6 col-sm-4 col-lg-12">
  27. <div class="thumbnail">
  28. <div class="caption">
  29. <h3>${element.PRODUTO}</h3> <img class="fon" src="img/icon/guido.ico"/>
  30. <p class="flex-text text-muted">${element.STATUS}</p>
  31. <br>
  32. <p><a class="btn btn-primary" type="button" id="${element.ID}" href="progress.php" >Acompanhar Pedido</a></p>
  33. </div>
  34. </div>
  35. </div>`);
  36. })
  37. })
  38. )
  39.  
  40. }
  41.  
  42. // Default options are marked with *
  43. fetch('http://api_aqui', {
  44. method: 'POST',
  45. headers: {'Content-Type':'application/x-www-form-urlencoded'},
  46. body: `ID=${ID}`
  47.  
  48. }).then(response => response.json().then(data => ({
  49. data: data,
  50. status: response.status
  51. })
  52. ).then(res => {
  53. res.data.map(element => {
  54. var text = element;
  55. console.log(text);
  56.  
  57.  
  58. $('.progresso-1').append(`${element.NOME}`);
  59. $('.progresso-2').append(`${element.PRODUTO}`);
  60. $('.progresso-3').append(`${element.CPF}`);
  61. $('.progresso-4').append(`${element.CIDADE}`);
  62. $('.progresso-5').append(`${element.ENTREGAPREVISTA}`);
  63. $('.progresso-6').append(`${element.CODPRODUTO}`);
  64. $('.progresso-7').append(`${element.CODCLIENTE}`);
  65. $('.progresso-8').append(`${element.ENTREGAPROGRAMADA}`);
  66. $('.progresso-9').append(`${element.NOTAFICAL}`);
  67. $('.progresso-10').append(`${element.QTDPEDIDO}`);
  68. $('.progresso-11').append(`${element.ENTREGACONFIRMADA}`);
  69. $('.progresso-12').append(`${element.MONTAGEMPREVISTA}`);
  70. $('.progresso-13').append(`${element.MONTCONFIRMADA}`);
  71.  
  72. })
  73. })
  74. )
  75.  
  76. }
Add Comment
Please, Sign In to add comment