title: changing the values of countries with flag in select box1 by onchange with ajax
body: <p>i am stuck at one point where i need to populate the country after the ajax resp but it is not showing selected here is the image
  <img src="https://i.stack.imgur.com/tvD14.jpg" alt="if i am selecting the african countries i should get only the united kingdom in select box 2 which i am getting but it is not selected as you can see in the image"></p>
  
  <p>if i am selecting other than african countries i should get all the countries in drop down which i am getting as you can see in the pic but the first one is not selected as you can see in the pic
  <img src="https://i.stack.imgur.com/mHBGN.png" alt="enter image description here"></p>
  
  <p>here is my code in jquery</p>
  
  <pre><code>        var country_data=countries;
              $.ajax({
              type: "POST",
              url: "ukcountry_ajax.php",
              datatype:"json",
              data:{ country:country_data}
          }).done(function( data ) 
                  {
  
              var final_country=JSON.parse(data);
  
              var $select=$('#tocurrency');
              $select.find('option').remove();
              $("#tocurrency").select2('data', {id: '', text: ''}); 
              $.each(final_country,function(index) 
              {
  
                  var image=final_country[index].final_image;
                  var name=final_country[index].countryname;
                  $('#tocurrency').append("&lt;option value="+image+"&gt;"+name+"&lt;/option&gt;");
  
              });
  
          });
  </code></pre>
  
  <p>can any body suggest where i am wrong code is wrkng fine in ie,chrome and FF but not getting selected the first country in the select box as it is showing empty
  TIA</p>