Bonjour, je cherche a utiliser la fonction getJSON de jquery pour parser un fichier JSON.

Le fichier en question est disponible a cette adresse:

http://www.careerjet.co.uk/devel/sea...ocation=London

Voici le code que j'utilise... Au debut c'est un essai / exemple avec l'API de Flickr....

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
 
  <script>
  $(document).ready(function(){
    $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
        function(data){
          $.each(data.items, function(i,item){
            $("<img/>").attr("src", item.media.m).appendTo("#images");
            $('<li>' + item.media.m + '</li>').appendTo('#images');
            $('<li>' + item.title + '</li>').appendTo('#images');
            $('<li>' + item.link + '</li>').appendTo('#images');
 
            if ( i == 3 ) return false;
          });
        });
  });
  </script>
 
    <script>
  $(document).ready(function(){
    $.getJSON("http://www.careerjet.co.uk/devel/search.api?keywords=php+developer&location=London",
        function(data2){
          $.each(data2.jobs, function(i,job){
            $('<li>' + item.locations + '</li>').appendTo('#aff');
            $('<li>' + item.title + '</li>').appendTo('#aff');
            $('<li>' + item.url + '</li>').appendTo('#aff');
            $('<li>' + item.description + '</li>').appendTo('#aff');
            if ( i == 3 ) return false;
          });
        });
  });
  </script>
 
</head>
<body>
  <div id="images">
  </div>
 
  <br><br><br><br><br><br><br><br><br><br><br><br><br><br>
 
  <div id="aff">
  </div>
 
 
 
</body>
</html>


Malheureusement je n'arrive pas a faire marcher ce truc.... J'ai beau tourné dans tout les sens etc....

Je precise que je n'utilise VOLONTAIREMENT PAS la fonction json_decode de PHP car je suis en PHP 4.0 et que mon hebergeur bloque les fonctions get_file_content(), fopen(), ...

La methode de getJSON fonctionne parfaitement comme on peut le voir sur l'exemple du debut... Malheureusement je n arrive pas a adapter ca a mon fichier...

SI quelqu'un aurait une piste ...

Cordialement,