For some reason, when I submit my form after initialising the onchange event, the parent id is no longer inserting the id into the database. Instead it inserts 'Select Event'. Is there something simple I'm missing?
FORM
<select class="form-control" id="parent_id" name="parent_id">
<option>Select Event</option>
@foreach (Event::all() as $item)
<option value="{{ $item->id }}">{{ $item->title }}</option>
@endforeach
</select>
<div id="child_id"></div>
JAVASCRIPT
$(document).ready(function($){
$('#parent_id').change(function(){
$.getJSON("{{ url('api/dropdown')}}", { option: $(this).val() },
function(data) {
if ( data.success == true) {
$('#busy').hide();
$.each(data, function(key, value) {
$('#child_id').append('<div> ' + value.name +'</div>');
});
}
});
});
});