get data from db to set as default in dropdown list created using jquery

get data from db to set as default in dropdown list created using jquery

  1. here is my below code create the dropdown using jquery. but what i need to do set default selection on this type of jquery creation based on mysql value. i did with this following code but its not working.please help me guyz..
  2.  

  3. <script>
  4. $('#orderbox2' + categories).text('Currency Notes'); //its not working for default selection)

  5. categories = {
  6.     "Select":[{value:'select',text:'Select'}],
  7. "United States":[{value:'<?php  echo 1;?>', text:'Select'},{value:'<?php  echo usa;?>', text:'Currency'},{value:'<?php  echo usa; ?>', text:'Forex'},{value:'<?php  echo usa; ?>', text:'Travells}],
  8.     "European":[{value:'<?php       echo 2;?>', text:'Select'},{value:'<?php  echo eur;?>', text:'Currency '},{value:'<?php  echo eur; ?>', text:'Forex},{value:'<?php  echo eur; ?>', text:'Travells'}],
  9.     "Britian":[{value:'<?php        echo 3?>', text:'Select'},{value:'<?php  echo gbp;?>', text:'Currency'},{value:'<?php  echo gbp; ?>', text:'Forex'}
  10. };

  11. function selectchange($this) {
  12.         var select = $this.parents('.product-item').find('.orderbox2');
  13.         select.empty();
  14.         $.each(categories[$(':selected', $this).text()], function () {
  15.             select.append('<option value="' + this.value + '">' + this.text + '</option>');
  16.         });
  17.     }

  18. $(function () {
  19.     $("#product").on("change", '.orderbox1', function() { selectchange($(this)) });
  20.     $("#product").append(categories);
  21. });

  22. </script>