Advertisement
Mirelawiel

importer JSON

Feb 19th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.57 KB | None | 0 0
  1.  
  2. <h1>EXERCICE 3 : JSON </h1>
  3.  
  4.  
  5. <button type ="button" onclick="GenererFichier()">FichierJSON</button>
  6. <button type ="button" onclick="GenererFichierNuage()">FichierJSON</button>
  7.  
  8.  <h5 id="ptest4"> </h5>
  9.  
  10.  <script type="text/javascript">
  11.  
  12.     function GenererFichier(){
  13.         $.getJSON( "fichier.json", function(data) {
  14.         $('#ptest4').append("<ul>");
  15.         $.each( data.employees, function(i,item) {
  16.               $('#ptest4').append("<li>" + item.firstName + "  " +item.lastName+ "</li>");
  17.         });
  18.         $('#ptest4').append("</ul>");
  19. });
  20. }
  21.  
  22.  
  23.  </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement