Hallo,
ich habe folgende Funktion
$( "#testLocation" ).submit(function( event ) {
event.preventDefault();
var send = $("#testLocation").serialize();
$.ajax({
type: "POST",
url: "insertLocation.php",
data: send,
dataType: 'json',
success: function(data) {
$("#location_id option:last").after($('<option value="'+ data.l_code +'" selected>'+ data.l_locationname +'</option>'));
$("#location_id").trigger("chosen:updated");
function clearInputs(data){
$("#testLocation :input").each(function(){
$(this).val('');
});
};
clearInputs();
$.fancybox.close();
}
});
});
Habe ich die Möglichkeit nach dem Update folgende Option auszuführen
onchange="this.form.submit()"
Dieses benötige ich für das Abschicken von meinem Eintrag
<form action="" method="POST">
<select name="location_id" id="location_id" data-placeholder="Bitte wählen..." class="chosen-select" style="margin-top: 0; width: 85%" onchange="this.form.submit()">
<option value=""></option>
<?php foreach($frontend_location as $array): ?>
<option value="<?php echo htmlspecialchars($array['l_code']); ?>" <?php echo ($b_veranstaltungsort == $array['l_code'] ? "selected" : "");?>>
<?php echo htmlspecialchars($array['l_locationname'] . " " . $array['l_plz'] . " " . $array['l_ort'] ); ?>
</option>
<?php endforeach; ?>
</select>
</form>