$db = JFactory::getDbo();
$uri =JURI::getInstance();
$url= $uri->root();
$post = JRequest::get ('post');   
   global $HTTP_RAW_POST_DATA;
 
 $post = json_decode($HTTP_RAW_POST_DATA, true);
//$post['countryid'] = 64;
  
  $query='SELECT * FROM #__jetour_city where published=1 AND country_id='.$post['countryid'].' order by city_name' ;
  $db->setQuery($query); 
  $parents=$db->loadObjectList();


         $procedure=array();
  
 if($parents)
 { 
  
  for($i=0;$i<count($parents);$i++)
  {
   $row=$parents[$i];
   
   $procedurearray=array();
    
   $procedurearray['city_id']=$parents[$i]->city_id;
   $procedurearray['city_name']=$parents[$i]->city_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;
  
 }