bonjour,
je souhaiterai faire à la suite d'une requete,
Code php : 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 header ( "Cache-Control: no-store, no-cache, must-revalidate" ) ; header ( "Cache-Control: post-check=0, pre-check=0", false ) ; header ( "Pragma: no-cache" ) ; $type = $_GET['type']; $id = $_GET['id']; switch ($type) { case 'id_lieu_projet': $data =o(qGet("SELECT * FROM projets_lieux INNER JOIN lieux ON lieux.id=projets_lieux.id_lieu WHERE id_lieu_structure_projet='" . mysql_real_escape_string($id) . "'")); $_GET['adresse'] = $data->adresse; $_GET['cp'] = $data->cp; $_GET['ville'] = $data->ville; $_GET['pays'] = $data->pays; $_GET['id_civilite'] = $data->id_civilite; $_GET['nom'] = $data->nom; $_GET['prenom'] = $data->prenom; $_GET['tel'] = $data->tel; $_GET['email'] = $data->email; break; default: break; } ob_clean ( ) ; echo json_encode ( aUTF8($_GET) ) ;
Faire un each dans la fonction success :
au lieu de déclarer chaque valeur.
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 $('#id_lieu_projet').change( function() { app.wait(); app.ajax({ type: "get", dataType:"json", url: 'app/ajax.php?type=id_lieu_projet&id=' + $(this).val(), success: function(data, status, rsp){ $("#adresse_livraison").val(data.adresse); $("#cp_livraison").val(data.cp); $("#ville_livraison").val(data.ville); $("#pays_livraison").val(data.pays); app.unwait(); } }); } );
Apparemment, each permettrait de faire cette manipulation, mais je n'y parviens pas.
pouvez-vous m'aider.
Partager