Created
December 15, 2015 16:30
-
-
Save elgamine-dev/108f0877b886f3141797 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vous allez remplacer votre nom par <span elt="first_name"></span> | |
par exemple : | |
<h1>Amine El G</h1> | |
deviens | |
<h1><span elt="first_name"></span> <span elt="last_namr"></span></h1> | |
pareille avec votre titre | |
Algo dans votre app.js : | |
- charger le fichier user-{id}.json en ajax avec la methode getJSON | |
ensuite dans le callback | |
- vous allez recuperer tous les elements ayant l'attribut `elt` | |
- une boucle for avec chacun de ses elements | |
- lire l'attribut elt de cet élément | |
- le remplacer par la clé qui correspond dans le json qu'on a récupéré |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id":"", | |
"first_name":"", | |
"last_name":"", | |
"occupation":"", | |
"badges":"", | |
"contact":{ | |
"email":"", | |
"website":"" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment