Je le fichier de code JSON suivant nommé: sections.jsonjQuery avec JSON
{
"section1": { "priority": 1, "html": '<img src="../images/google.png" />'},
"section2": { "priority": 2, "html": '<input type="button" value="Login" />'},
"section3": { "priority": 3, "html": '<div>Some text</div>'},
"section4": { "priority": 4, "html": '<div>Some text</div>'},
"section5": { "priority": 5, "html": '<select><option>option1</option> <option>option2</option></select>'}
}
J'essaie dans votre code jquery mais alerte ne fonctionne pas
$.getJSON("sections.json", function(json) {
alert('h');
});
Le chemin d'accès au fichier est-il correct? – rahul
Que signifie "ne fonctionne pas"? Qu'est-ce qui se passe? Que faire si vous examinez le DOM et toutes les demandes XHR en utilisant Firebug? – Quentin