// CountryList
$db = JFactory::getDbo();
$uri =JURI::getInstance();
$url= $uri->root();
  
  $query='SELECT getcountrylst FROM #__jetour_package where published=1 AND ( `start_date` <= DATE(NOW()) AND `end_date` >= DATE(NOW()) ) AND getcountrylst!=""' ;
  $db->setQuery($query); 
  $countryids=$db->loadColumn();
 
  $countryids = implode(',',$countryids);
  $countryidss = explode(',',$countryids);
  $countryidsss = array_unique($countryidss);
  $countryids = implode(',',$countryidsss);
  
  $query='SELECT DISTINCT country_id,country_name FROM #__jetour_country where published=1 AND country_id IN('.$countryids.') order by country_name' ;
  $db->setQuery($query); 
  $parents=$db->loadObjectList();


         $procedure=array();
  
 if($parents)
 { 
  
  for($i=0;$i<count($parents);$i++)
  {
   $row=$parents[$i];
   
   $procedurearray=array();
    
   $procedurearray['country_id']=$parents[$i]->country_id;
   $procedurearray['country_name']=$parents[$i]->country_name;
   $procedure[]=$procedurearray;
  }
  
  
  
   $arr = array('success' => '1','procedure' => $procedure);
      echo json_encode($arr);exit;
  
 }
 else
 {
  
    $arr = array('success' => '0','procedure' => 'No Record Found');
     echo json_encode($arr);exit;
  
 }