Quote Originariamente inviata da fermat Visualizza il messaggio
si ma come lo crei il selection?
deve avere una struttura tipo questa:
codice:
var data = { 
    "nome": "NOME", 
    "cognome": "COGNOME", 
    "eta": 20  
}; 
 
$.getJSON(URL, data, function (result) { 
    ...... 
});
nel primo post c'è il codice completo. lo riporto qui. la select funziona correttamente

codice:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Load Cars By Choice</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
    $(document).ready(function (){
        $('#select').change(function (){

                //debug
                var model = $(this).val();

                var str = "";

                $("select option:selected").each(function(){
                    str += "<br/><div><b>Company Name: </b>" + $(this).text() + "</div><br/>";

                    var selection = $(this).text();

                    var carModelUrl = ".../my_mvc/index.php/loadCarsByChoice";

                    $.getJSON(carModelUrl, selection, function(json){
                        console.log("JSON: ", json);
                        str += "<table>";

                        for (var i = 0; i < json.length; i++) {
                            str += "<tr><td>" + (i+1) + " - " + json[i].BrandName +
                            "</td><td>" + json[i].Model +
                            "</td><td>" + json[i].Colour +
                            "</td><td><img src='../assets/" + json[i].BrandName + ".jpg'></img></td></tr>";
                        }

                        str += "</table>";

                        document.getElementById("placeholder").innerHTML=str;

                    });
                });
            });
})
</script>
</head>
<body>
    <h1>Choose a car to see details</h1>
    <form>
        <select id="select">
            <?php
            for ($i=0; $i < count($data); $i++) { 
                echo "<option value='".$data[$i]."'>".$data[$i]."</option>";
            }
            ?>
        </select>
    </form>

    <div id="placeholder"></div>
</body>
</html>