0

My script runs fine

$.getJSON("../Conseiller/EditerDemandeurs_MenuConseiller",{sIdDdeur: idDdeur}, function (data, status) {
    var result = JSON.stringify(data);
    console.log(data);
    console.log(result);
});

and when I pass it to console.log it gives:

Object {rows: Array[1]}
ModalForms.js:10 {"rows":[{"Code_Demandeur":"DD_ANLI000003","Nom_Demandeur":"Anderson","Prenoms_Demandeur":"Liam","UserId":null,"Adresse_Demandeur":"1136 AllEe Gerard Morisset Monarque","Ville":"Saint-Eugène-d'Argentenay (MunicipalitE de)","Province":"QuEbec","CodePostal_Demandeur":"H7A2A7","Tel1_Demandeur":"4180010502          ","Tel2_Demandeur":"5141921617          ","Tel3_Demandeur":null,"Courriel1_Demandeur":"Doiron [email protected]","Courriel2_Demandeur":null,"Courriel3_Demandeur":null,"SitMat":"Couple avec enfant","Sexe":"Femme","Date_Naissance_Demandeur":"/Date(-642542400000)/","Revenu_Demandeur":null,"Occupation":"INFIRMIER","Scolarite":"Doctorat","StatutLegal":"REsident permanent","Communaute":"Africaine","SourceInformation":"Accès travail emploi femme","Handicape":false,"Reference":null,"Remarques_Demandeur":null,"ID_Photo":null,"Actif_Inactif":true,"Dte_Saisie":"/Date(1464913323033)/","ID_Utilisateur":1,"Nom_Type_Demandeur":"Principal"}]}

My question is how I assign those values to variables?
Using xx = data.Code_Demandeur for example gives me "Undefined" error.

1
  • data.rows[0].Code_Demandeur Commented Jul 2, 2016 at 1:55

1 Answer 1

1

Code_Demandeur resides in a object which is at 0th index of the array

$.getJSON("../Conseiller/EditerDemandeurs_MenuConseiller", {
  sIdDdeur: idDdeur
}, function(data, status) {
  console.log(data.rows[0].Code_Demandeur);
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.