$(document).ready(function() {
var urlBase = "http://fipeapi.appspot.com/api/1/carros/";
$.getJSON(urlBase + "marcas.json", function(data) {
var items = ["<option value=\"\">ESCOLHA UMA MARCA</option>"];
$.each(data, function(key, val) {
items += ("<option value='" + val.id + "'>" + val.name + "</option>");
});
$("#marcas").html(items);
});
$("#marcas").change(function() {
$.getJSON(urlBase + "veiculos/" + jQuery(this).val() + ".json", function(data) {
var items = ["<option value=\"\">ESCOLHA UM VEICULO</option>"];
$.each(data, function(key, val) {
items += ("<option value='" + val.id + "'>" + val.name + "</option>");
});
$("#veiculos").html(items);
});
});
$("#veiculos").change(function() {
$.getJSON(urlBase + "veiculo/" + jQuery("#marcas").val() + "/" + jQuery(this).val() + ".json", function(data) {
var items = ["<option value=\"\">ESCOLHA O ANO</option>"];
$.each(data, function(key, val) {
items += ("<option value='" + val.id + "'>" + val.name + "</option>");
});
$("#ano").html(items);
});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><body><selectid="marcas">
</select>
<select id="veiculos">
</select>
<select id="ano">
</select>
</body>
I made the code to load JSON using the base of this site link But I would like to send this data that you download from Json by email. The query works fine because I could also resume to display the full concatenated data on the screen, but I'm not sure how to get the data selected from the list stored in my database and also sent by email.