jquery only passing dropdownbox highest value
i've got a dropdownbox which has values assigned to it, and i'm trying to
retrieve that value and perform a .load function and return the value, but
it didn't turned out as so, the value being retrieved is always the top of
the dropdownlist no matter what is selected.
Here's my jquery
<script>
$(document).ready(function(){
var inputField= $('#dateslot').val();
$("#dateslot").change(function(){
$("#timeslot").load('check.php?dateselect='+inputField);
});
});
</script>
While here's my dropdownbox
<select name="dateslot" style="margin-bottom: 20px;" id="dateslot">
<option value="notselected">SELECT A DATE</option>
<?php
for($i = 1; $i/31 != 1; $i++){
$date1 = str_replace('-', '/', $vdate);
$date2 = date('Y-m-d',strtotime($date1 . "+".$i." days"));
$readdate = date('d F Y', strtotime($date2));
echo '<option value="'.$date2.'">'.$readdate.'</option>';
}
?>
</select>
in my check.php i got the dateselect using $_GET and found out that no
matter what i select, the result is always notselected(which is the first
option)
i tried stripping that code out, the value shown is still the first of the
list, i tried taking out the php and use only the options, same result.
any help =/ ?
No comments:
Post a Comment