have a little issue with jquery and couldn´t find a solution yet:
when page loads there the selectbox is filled with data from my sql. but the value is "undefined".
$(document).ready(function(){
$.get("", function(data){
$.each(data,function(i,value){
var option =$("<option>",
{text : value.hersteller}
)
$('#hersteller1').append(option);
})
})
var select = $("#hersteller1 option:selected").val();
console.log(select);
so my second jquery function doesen´t work:
$('#hersteller1').on('change', function(e){
$('#modell1').empty()
var herstellerAuswahl=e.target.value;
$.ajax({
type: 'post',
url:'',
dataType: "json",
data:{'title':herstellerAuswahl},
success:function(data){
$.each(data,function(j,value){
var option =$("<option>",
{text : value.modell})
$('#modell1').append(option);
})
}
})
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire