Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <script type="text/javascript" charset="utf-8">
  2. $(document).ready(function(){
  3. $('.chosen-select').chosen({
  4. no_results_text: "Oops, nothing found!"
  5. });
  6. $('#search1').on('change', function (){
  7. $('#search2').html("<option value=''>Select</option>");// add this on each call then add the options when data receives from the request
  8. $.getJSON('select.php', {id: $(this).val()}, function(data){
  9. var options = '';
  10. for (var x = 0; x < data.length; x++) {
  11. options += '<option value="' + data[x]['id'] + '">' + data[x]['Date'] + '</option>';
  12. }
  13. $('#search2').html(options);
  14. //$('.chosen-select').chosen();
  15. });
  16. });
  17. });
  18. </script>
  19.  
  20. <select id="search2" name="search" type="text" data-placeholder="Choose an Option..." style="width:370px;" class="chosen-select" onChange="drawChart(this.value);">
  21. <option value=""></option>
  22. </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement