[SOLUCIONADO]JSON SELECT Framework 7

hello I have the following code:

  • Género
    Masculino Femenino
  • JS

    app.request({
    url: ‘pais.php’,
    method: ‘GET’,
    dataType: ‘json’,
    //send “query” to server. Useful in case you generate response dynamically
    data: {
    query: query
    },
    success: function (data) {

            alert(data);
    

    }
    });

    data is an array with id and country what I want is to fill the above select with the information of this array I am using f7 2.0 thanks!

    ** I believe your error is in your syntax. **

    http://framework7.io/docs/dom.html#ajax

    Hi @erick123,

    Can you post your JSON Array and how you are parsing in success method?

    As my understanding the JSON Array looks like below

    {
    ‘GENDER’ :[‘MALE’ , ‘FEMALE’]
    }

    Then you can parse like below in success method:

    success: function (data){
    console.log (data.GENDER[0]); //It will print MALE
    console.log (data.GENDER[1]); //It will print FEMALE
    }

    1 Like