Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" charset="utf-8">
- $(document).ready(function(){
- $('.chosen-select').chosen({
- no_results_text: "Oops, nothing found!"
- });
- $('#search1').on('change', function (){
- $('#search2').html("<option value=''>Select</option>");// add this on each call then add the options when data receives from the request
- $.getJSON('select.php', {id: $(this).val()}, function(data){
- var options = '';
- for (var x = 0; x < data.length; x++) {
- options += '<option value="' + data[x]['id'] + '">' + data[x]['Date'] + '</option>';
- }
- $('#search2').html(options);
- //$('.chosen-select').chosen();
- });
- });
- });
- </script>
- <select id="search2" name="search" type="text" data-placeholder="Choose an Option..." style="width:370px;" class="chosen-select" onChange="drawChart(this.value);">
- <option value=""></option>
- </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement