api fire

api fire

Hi,

How would you get an api to fire not when the page loads but when the dropdown form element (including its little downward arrow) is clicked on?

My current working script is

Thanks in advance

  1.     <script>
            var blah= $('#BlahID');
            var blah_api_url = 'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
            jQuery.get(blah_api_url, function (data) {
                $(data).each(function (key, val) {
                    console.log(key);
                    blah($("<option>").attr('value', val[0]).text(val[1]));
                });
            }, 'json');
  2.     </script>