• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cascading dropdowns

#1
hi all, i'm a newbie of codeigniter, my problem is to create a cascading dropdowns populated from db data. In my insert form the first dropdown is populated with the variables exploded of a controller's data array. how can I populate the second dropdown based on the choice of the first?

thanks a lot
Reply

#2
Do it in JavaScript. Make an ajax call that return the data for the next dropdown in JSON format, build the option list and copy it to the dropdown. With jQuery this is very easy to do.
Reply

#3
(12-16-2014, 08:51 PM)includebeer Wrote: Do it in JavaScript. Make an ajax call that return the data for the next dropdown in JSON format, build the option list and copy it to the dropdown. With jQuery this is very easy to do.

Hi, this is my code:
in the controller i have this:
public function get_roads_by_city()
{
$idcity = $this->uri->segment(3);
header('Content-Type: application/json');
echo json_encode($this->users_model->get_roads_by_city($idcity));
}

in the model i have this:
public function get_roads_by_city($idcity)
{
$this->db->select('*');
$this->db->where('city', $idcity);
$query = $this->db->get('roads');
$roads = array();

if($query->result()){
foreach ($query->result() as $road) {
$roads[$road->idroad] = $road->road;
}
return $roads;
} else {
return FALSE;
}
}

the script in the view is:
<script src="<?php echo base_url('/assets/js/jquery-1.11.1.min.js'); ?>" type="text/javascript"></script>
<script type="text/javascript">

$('#city').change(function()
{
var idcity = $('#city').val();
if (idcity != "")
{
var post_url = "<?php echo site_url('users/get_roads_by_city'); ?>" + '/'+idcity;
$.ajax({
type: "POST",
url: post_url,
dataType:'json',
success: function(roads) //we're calling the response json array 'roads'
{
$('#road').append(0,'road:');
$.each(roads,function(idroad,road)
{
var opt = $('<option />'); // here we're creating a new select option for each group
opt.val(idroad);
opt.text(road);
$('#road').append(opt);
});
} //end success
});
}
});
</script>

the dropdowns in the view are:
<select name="city" id="city">
<option value=""></option>
<?php foreach($city as $each){ ?>
<option value="<?php echo $each->idcity; ?>"><?php echo $each->city; ?></option>';
<?php } ?>
</select>

<select name="road" id="road">
<?php
foreach($roads as $road): ?>
<option value="<?php echo $road['idroad']; ?>" >
<?php echo $road['road']; ?>
</option>
<?php
endforeach;
?>
</select>

when i select a value in the first dropdown, the second remains empty....
where am i wrong?
help me.... thanks
Reply

#4
this code for dropdowns in cascade:

attachment my code in file .txt


Attached Files
.txt   dropdowns cascade.txt (Size: 30.42 KB / Downloads: 119)
Reply

#5
(12-17-2014, 08:42 AM)draven Wrote: [quote='includebeer' pid='2633' dateline='1418788262']
Do it in JavaScript. Make an ajax call that return the data for the next dropdown in JSON format, build the option list and copy it to the dropdown. With jQuery this is very easy to do.

this code for dropdowns in cascade:
code of js:
function selectMunicipio(depto_id){
if(depto_id!="-1"){
loadData('Municipio',depto_id);
$("#Canton_dropdown").html("<option value='-1'>Canton</option>");
}else{
$("#Municipio_dropdown").html("<option value='-1'>Municipio</option>");
$("#Canton_dropdown").html("<option value='-1'>Canton</option>");
$("#Caserio_dropdown").html("<option value='-1'>Caserio</option>");

}
}

function selectCanton(munpo_id){
if(munpo_id!="-1"){
loadData('Canton',munpo_id);
}else{
$("#Canton_dropdown").html("<option value='-1'>Canton</option>");
}
}

function selectCaserio(canton_id){
if(canton_id!="-1"){
loadData('Caserio',canton_id);
}else{
$("#Caserio_dropdown").html("<option value='-1'>Caserio</option>");
}
}

function loadData(loadType,loadId){
var dataString = 'loadType='+ loadType +'&loadId='+ loadId;
$("#"+loadType+"_loader").show();
   $("#"+loadType+"_loader").fadeIn(400).html('Cargando... <img src="image/loading.gif" />');
$.ajax({
type: "POST",
url: "loadData",
data: dataString,
cache: false,
success: function(result){
$("#"+loadType+"_loader").hide();
$("#"+loadType+"_dropdown").html("<option value='-1'>"+loadType+"</option>");  
$("#"+loadType+"_dropdown").append(result);  
}
});
}



code controller:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class controller extends CI_Controller {

public function __construct()
{
parent::__construct();
}

public function index()
{
$this->load->model('model');
$result['list']=$this->model->getDepto();
//$this->load->view('top');
$this->load->view('index',$result);
//$this->load->view('footer');
}

public function loadData()
{
$loadType=$_POST['loadType'];
$loadId=$_POST['loadId'];

$this->load->model('model');
$result=$this->model->getData($loadType,$loadId);
$HTML="";

if($result->num_rows() > 0){
foreach($result->result() as $list){
$HTML.="<option value='".$list->id."'>".$list->name."</option>";
}
}
echo $HTML;
}
}

code Model:
<?php
class model extends CI_Model
{
function __construct()
{
parent::__construct();
}

function getDepto(){
$this->db->select('id,depto');
$this->db->from('departamentos');
$this->db->order_by('depto', 'asc');
$query=$this->db->get();
return $query;
}

function getData($loadType,$loadId){
if($loadType=="Municipio"){
$fieldList='id,munpo as name';
$table='municipios';
$fieldName='depto_id';
$orderByField='munpo';
}else{
$fieldList='id,canton as name';
$table='cantones';
$fieldName='munpo_id';
$orderByField='canton';

}if($loadType=="Caserio"){
$fieldList='id,caserio as name';
$table='caserios';
$fieldName='canton_id';
$orderByField='caserio';
}

$this->db->select($fieldList);
$this->db->from($table);
$this->db->where($fieldName, $loadId);
$this->db->order_by($orderByField, 'asc');
$query=$this->db->get();
return $query;
}
}
?>

code View:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>


   <div id="wrapper">
<div class="wrap_box">
<?php
if($list->num_rows > 0){
?>
<table>
<tr>
<td>
<select onchange="selectMunicipio(this.options[this.selectedIndex].value)">
<option value="-1">Departamentos</option>
<?php
foreach($list->result() as $listElement){
?>
<option value="<?php echo $listElement->id ;?>"><?php echo $listElement->depto ;?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>
<select id="Municipio_dropdown" onchange="selectCanton(this.options[this.selectedIndex].value)">
<option value="-1">Municipios</option>
</select>
<span id="Municipio_loader"></span>
</td>
</tr>

<tr>
<td>
<select id="Canton_dropdown" onchange="selectCaserio(this.options[this.selectedIndex].value)">
<option value="-1">Cantones</option>
</select>
<span id="Canton_loader"></span>
</td>
</tr>
<tr>
<td>
<select id="Caserio_dropdown">
<option value="-1">Caserios</option>
</select>
<span id="Caserio_loader"></span>
</td>
</tr>
</table>
<?php
}else{
echo 'No Country Name Found';
}
?>

</div>
   </div>

***************************************************

script database:

create database complejo;
use complejo;

--
-- Estructura de tabla para la tabla `cantones`
--

CREATE TABLE IF NOT EXISTS `cantones` (
 `id` char(11) NOT NULL,
 `canton` varchar(100) NOT NULL,
 `munpo_id` char(11) NOT NULL,
 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
 `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
 `cod` int(11) NOT NULL AUTO_INCREMENT,
 PRIMARY KEY (`cod`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Volcar la base de datos para la tabla `cantones`
--

INSERT INTO `cantones` (`id`, `canton`, `munpo_id`, `created`, `updated`, `cod`) VALUES
('0', '1Desconocido', '0', '2014-11-25 16:25:16', '0000-00-00 00:00:00', 0),
('1', 'Chilata', '10', '2014-11-25 16:16:51', '0000-00-00 00:00:00', 1),
('2', 'El Bebedero', '10', '2014-11-25 16:16:53', '0000-00-00 00:00:00', 2),
('3', 'Los Lagartos', '10', '2014-11-25 16:16:55', '0000-00-00 00:00:00', 3);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `caserios`
--

CREATE TABLE IF NOT EXISTS `caserios` (
 `id` char(11) NOT NULL,
 `caserio` varchar(100) NOT NULL,
 `canton_id` char(11) NOT NULL,
 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
 `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
 `cod` int(11) NOT NULL AUTO_INCREMENT,
 PRIMARY KEY (`cod`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;

--
-- Volcar la base de datos para la tabla `caserios`
--

INSERT INTO `caserios` (`id`, `caserio`, `canton_id`, `created`, `updated`, `cod`) VALUES
('0', '1Desconocido', '0', '2014-11-25 16:25:24', '0000-00-00 00:00:00', 0),
('1', 'Huascalio', '3', '2014-11-18 14:36:31', '0000-00-00 00:00:00', 1),
('2', 'Camandula', '3', '2014-11-18 14:37:14', '0000-00-00 00:00:00', 2),
('3', 'Casa Blanca', '3', '2014-11-18 14:37:38', '0000-00-00 00:00:00', 3),
('4', 'Casco Hacienda', '3', '2014-11-18 14:37:50', '0000-00-00 00:00:00', 4),
('5', 'El Ingenio', '3', '2014-11-18 14:38:01', '0000-00-00 00:00:00', 5),
('6', 'Los Corrales', '3', '2014-11-18 14:39:25', '0000-00-00 00:00:00', 6),
('7', 'El Olvido 1', '3', '2014-11-18 14:39:58', '0000-00-00 00:00:00', 7),
('8', 'El Olvido 2', '3', '2014-11-18 14:39:50', '0000-00-00 00:00:00', 8),
('9', 'El Cujinal', '3', '2014-11-18 14:42:27', '0000-00-00 00:00:00', 9),
('10', 'El Once', '3', '2014-11-18 14:42:54', '0000-00-00 00:00:00', 10),
('11', 'Salitrio', '3', '2014-11-18 14:43:22', '0000-00-00 00:00:00', 11),
('12', 'El Cruzado', '3', '2014-11-18 14:44:23', '0000-00-00 00:00:00', 12),
('13', 'El Zocabon', '3', '2014-11-18 14:44:46', '0000-00-00 00:00:00', 13),
('14', 'Nueva Esperanza', '3', '2014-11-18 14:45:23', '0000-00-00 00:00:00', 14),
('15', 'Las Brisas', '3', '2014-11-18 14:45:54', '0000-00-00 00:00:00', 15),
('16', 'El Milagro', '3', '2014-11-18 14:47:28', '0000-00-00 00:00:00', 16),
('17', 'El Planon', '3', '2014-11-18 14:47:48', '0000-00-00 00:00:00', 17),
('18', 'San Jose', '3', '2014-11-18 14:48:27', '0000-00-00 00:00:00', 18),
('19', 'Las Mercedes', '3', '2014-11-18 14:48:48', '0000-00-00 00:00:00', 19),
('20', 'Los Angeles', '3', '2014-11-18 14:49:07', '0000-00-00 00:00:00', 20);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `departamentos`
--

CREATE TABLE IF NOT EXISTS `departamentos` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `depto` varchar(25) NOT NULL,
 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
 `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
 PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;

--
-- Volcar la base de datos para la tabla `departamentos`
--

INSERT INTO `departamentos` (`id`, `depto`, `created`, `updated`) VALUES
(0, '1Desconocido', '2014-11-25 16:25:32', '0000-00-00 00:00:00'),
(1, 'Ahuachapan', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(2, 'Santa Ana', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(3, 'Sonsonate', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(4, 'La Libertad', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(5, 'San Salvador', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(6, 'Cuscatlan', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(7, 'Chalatenango', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(8, 'San Vicente', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(9, 'Cabañas', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(10, 'Usulután', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(11, 'San Miguel', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(12, 'Morazán', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(13, 'La Paz', '2014-11-18 10:51:27', '0000-00-00 00:00:00'),
(14, 'La Unión', '2014-11-18 10:51:27', '0000-00-00 00:00:00');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `municipios`
--

CREATE TABLE IF NOT EXISTS `municipios` (
 `id` char(11) NOT NULL,
 `munpo` varchar(25) NOT NULL,
 `depto_id` char(11) NOT NULL,
 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
 `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
 `cod` int(15) NOT NULL AUTO_INCREMENT,
 PRIMARY KEY (`cod`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=263 ;

--
-- Volcar la base de datos para la tabla `municipios`
--

INSERT INTO `municipios` (`id`, `munpo`, `depto_id`, `created`, `updated`, `cod`) VALUES
('0', '1Desconocido', '0', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0),
('1', 'apaneca', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1),
('2', 'Tacuba', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 2),
('4', 'Ahuachapan', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 3),
('3', 'Ataco', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 4),
('5', 'Atiquizaya', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 5),
('6', 'El Refugio', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 6),
('7', 'Guaymango', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 7),
('8', 'Jujutla', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 8),
('9', 'San Francisco Menéndez', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 9),
('10', 'San Lorenzo', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 10),
('11', 'San Pedro Puxtla', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 11),
('12', 'Turín', '1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 12),
('1', 'Candelaria de la Frontera', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 13),
('2', 'Chalchuapa', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 14),
('3', 'Coatepeque', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 15),
('4', 'El Congo', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 16),
('5', 'El Porvenir', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 17),
('6', 'Masahuat', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 18),
('7', 'San Antonio Pajonal', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 19),
('8', 'San Sebastián Salitrillo', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 20),
('9', 'Santa Ana', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 21),
('10', 'Santa Rosa Guachipilín', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 22),
('11', 'Santiago de la Frontera', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 23),
('12', 'Texistepeque', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 24),
('13', 'Metapán', '2', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 25),
('1', 'Acajutla', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 26),
('2', 'Armenia', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 27),
('3', 'Caluco', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 28),
('4', 'Cuisnahuat', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 29),
('5', 'Izalco', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 30),
('6', 'Juayúa', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 31),
('7', 'Nahuizalco', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 32),
('8', 'Salcoatitán', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 33),
('9', 'San Antonio de Monte', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 34),
('10', 'San Julián', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 35),
('11', 'Santa Catarina Masahuat', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 36),
('12', 'Santa Isabel Ishuatán', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 37),
('13', 'Santo Domingo de Guzmán', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 38),
('14', 'Sonsonate', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 39),
('15', 'Sonzacate', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 40),
('16', 'Nahulingo', '3', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 41),
('1', 'Antiguo Cuscatlán', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 42),
('2', 'Chiltiupán', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 43),
('3', 'Ciudad Arce', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 44),
('4', 'Colón', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 45),
('5', 'Comasagua', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 46),
('6', 'Huizúcar', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 47),
('7', 'Jayaque', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 48),
('8', 'Jilapa', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 49),
('9', 'La Libertad', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 50),
('10', 'Santa Tecla', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 51),
('11', 'Nuevo Cuscatlán', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 52),
('12', 'San Juan Opico', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 53),
('13', 'Quezaltepeque', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 54),
('14', 'Sacacoyo', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 55),
('15', 'San José Villanueva', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 56),
('16', 'San Matías', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 57),
('17', 'San Pablo Tacachico', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 58),
('18', 'Talnique', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 59),
('19', 'Tamanique', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 60),
('20', 'Teotepeque', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 61),
('21', 'Tepecoyo', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 62),
('22', 'Zaragoza', '4', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 63),
('1', 'Aguilares', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 64),
('2', 'Apopa', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 65),
('3', 'Ayuxtepeque', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 66),
('4', 'Delgado', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 67),
('5', 'Cuscatancingo', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 68),
('6', 'El Paisnal', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 69),
('7', 'Guazapa', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 70),
('8', 'Ilopango', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 71),
('9', 'Mejicanos', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 72),
('10', 'Nejapa', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 73),
('11', 'Panchimalco', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 74),
('12', 'Rosario de Mora', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 75),
('13', 'San Marcos', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 76),
('14', 'San Martín', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 77),
('15', 'San Salvador', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 78),
('16', 'Santiago Texacuangos', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 79),
('17', 'Santo Tomás', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 80),
('18', 'Soyapango', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 81),
('19', 'Tonacatepeque', '5', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 82),
('1', 'Candelaria', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 83),
('2', 'Cojutepeque', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 84),
('3', 'El Carmen', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 85),
('4', 'El Rosario', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 86),
('5', 'Monte San Juan', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 87),
('6', 'Oratorio de Concepción', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 88),
('7', 'San Bartolemé Perulapía', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 89),
('8', 'San Cristóbal', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 90),
('9', 'San José Guayabal', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 91),
('10', 'San Pedro Perulapán', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 92),
('11', 'San Rafael Cedros', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 93),
('12', 'San Ramón', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 94),
('13', 'Santa Cruz Analquito', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 95),
('14', 'Santa Cruz Michapa', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 96),
('15', 'Suchitoto', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 97),
('16', 'Tenan', '6', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 98),
('1', 'Agua Caliente', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 99),
('2', 'Arcatao', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 100),
('3', 'Azacualpa', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 101),
('4', 'Chalatenango', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 102),
('5', 'Citalá', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 103),
('6', 'Comalapa', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 104),
('7', 'Concepción Quezaltepeque', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 105),
('8', 'Dulce Nombre de María', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 106),
('9', 'El Carrizal', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 107),
('10', 'El Paraíso', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 108),
('11', 'La Laguna', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 109),
('12', 'La Palma', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 110),
('13', 'La Reina', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 111),
('14', 'Las Vueltas', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 112),
('15', 'Nombre de Jesús', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 113),
('16', 'Nueva Concepción', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 114),
('17', 'Nueva Trinidad', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 115),
('18', 'Ojos de Agua', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 116),
('19', 'Potonico', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 117),
('20', 'San Antonio de la Cruz', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 118),
('21', 'San Antonio Los Ranchos', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 119),
('22', 'San Fernando', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 120),
('23', 'San Francisco Lempa', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 121),
('24', 'San Francisco Morazán', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 122),
('25', 'San Ignacio', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 123),
('26', 'San Isidro Labrador', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 124),
('27', 'San José Cancasque', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 125),
('28', 'San José Las Flores', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 126),
('29', 'San Luis del Carmen', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 127),
('30', 'San Miguel de Mercedes', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 128),
('31', 'San Rafael', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 129),
('32', 'Santa Rita', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 130),
('33', 'Tejutla', '7', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 131),
('1', 'Apastepeque', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 132),
('2', 'Guadalupe', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 133),
('3', 'San Cayetano', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 134),
('4', 'Istepeque', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 135),
('5', 'San Esteban Catarina', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 136),
('6', 'San Ildefonso', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 137),
('7', 'San Lorenzo', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 138),
('8', 'San Sebastián', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 139),
('9', 'San Vicente', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 140),
('10', 'Santa Clara', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 141),
('11', 'Santo Domingo', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 142),
('12', 'Tecoluca', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 143),
('13', 'Tepetitán', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 144),
('14', 'Verapaz', '8', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 145),
('1', 'Cinquera', '9', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 146),
('2', 'Dolores / Villa Dolores', '9', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 147),
('3', 'Guacotecti', '9', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 148),
('4', 'Ilobasco', '9', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 149),
('5', 'Jutiapa', '9', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 150),
('6', 'San Isidro', '9', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 151),
('7', 'Sensuntepeque', '9', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 152),
('8', 'Tejutepeque', '9', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 153),
('9', 'Victoria', '9', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 154),
('1', 'Alegría', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 155),
('2', 'Berlín', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 156),
('3', 'California', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 157),
('4', 'Concepción Batres', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 158),
('5', 'El Triunfo', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 159),
('6', 'Ereguayquín', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 160),
('7', 'Estanzuelas', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 161),
('8', 'Jiquilisco', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 162),
('9', 'Jucuapa', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 163),
('10', 'Jucuarán', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 164),
('11', 'Mercedes Umaña', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 165),
('12', 'Nueva Granada', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 166),
('13', 'Ozatlán', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 167),
('14', 'Puerto El Triunfo', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 168),
('15', 'San Agustín', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 169),
('16', 'San Buenabentura', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 170),
('17', 'San Dionisio', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 171),
('18', 'San Francisco Javier', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 172),
('19', 'Santa Elena', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 173),
('20', 'Santa María', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 174),
('21', 'Santiago de María', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 175),
('22', 'Santiago de María', '10', '2014-11-24 22:15:04', '0000-00-00 00:00:00', 176),
('23', 'Tecapán', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 177),
('24', 'Usulután', '10', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 178),
('1', 'Carolina', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 179),
('2', 'Chapeltique', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 180),
('3', 'Chirilagua', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 181),
('4', 'Ciudad Barrios', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 182),
('5', 'Comacarán', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 183),
('6', 'El Transito', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 184),
('7', 'Lolotique', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 185),
('8', 'Moncagua', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 186),
('9', 'Nueva Guadalupe', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 187),
('10', 'Nuevo Edén de San Juan', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 188),
('11', 'Quelepa', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 189),
('12', 'San Antonio del Mosco', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 190),
('13', 'San Gerardo', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 191),
('14', 'San Jorge', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 192),
('15', 'San Luis de la Reina', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 193),
('16', 'San Miguel', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 194),
('17', 'San Rafael Oriente', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 195),
('18', 'Sesori', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 196),
('19', 'Uluazapa', '11', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 197),
('1', 'Arambala', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 198),
('2', 'Cacaopera', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 199),
('3', 'Chilanga', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 200),
('4', 'Corinto', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 201),
('5', 'Delicias de Concepcíon', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 202),
('6', 'El Divisadero', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 203),
('7', 'El Rosario', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 204),
('8', 'Gualococti', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 205),
('9', 'Guatajiagua', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 206),
('10', 'Joateca', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 207),
('11', 'Lolotiquillo', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 208),
('12', 'Jocoaitique', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 209),
('13', 'Jocoro', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 210),
('14', 'Meanguera', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 211),
('15', 'Osicala', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 212),
('16', 'Perquín', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 213),
('17', 'San Carlos', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 214),
('18', 'San Fernando', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 215),
('19', 'San Francisco Gotera', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 216),
('20', 'San Isidro', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 217),
('21', 'San Simón', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 218),
('22', 'Sensembra', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 219),
('23', 'Sociedad', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 220),
('24', 'Torola', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 221),
('25', 'Yamabal', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 222),
('26', 'Yoloaiquín', '12', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 223),
('1', 'El Rosario / Rosario de L', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 224),
('2', 'Jerusalén', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 225),
('3', 'Mercedes de La Ceiba', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 226),
('4', 'Olocuilta', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 227),
('5', 'Paraíso de Osorio', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 228),
('6', 'San Antonio Masahuat', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 229),
('7', 'San Emigdio', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 230),
('8', 'San Francisco Chinameca', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 231),
('9', 'San Juan Nonualco', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 232),
('10', 'San Juan Talpa', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 233),
('11', 'San Juan Tepezontes', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 234),
('12', 'San Luis La Herradura', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 235),
('13', 'San Luis Talpa', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 236),
('14', 'San Miguel Tepezontes', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 237),
('15', 'San Pedro Masahuat', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 238),
('16', 'San Pedro Nonualco', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 239),
('17', 'San Rafael Obrajuelo', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 240),
('18', 'Santa María Ostuma', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 241),
('19', 'Santiago Nonualco', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 242),
('20', 'Tapalhuaca', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 243),
('21', 'Zacatecoluca', '13', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 244),
('1', 'Anamorós', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 245),
('2', 'Bolívar', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 246),
('3', 'Concepcíon de Oriente', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 247),
('4', 'Conchagua', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 248),
('5', 'El Carmen', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 249),
('6', 'El Sauce', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 250),
('7', 'Intipucá', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 251),
('8', 'La Union', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 252),
('9', 'Lilisque', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 253),
('10', 'Meanguera del Golfo', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 254),
('11', 'Nueva Esparta', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 255),
('12', 'Pasaquina', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 256),
('13', 'Polorós', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 257),
('14', 'San Alejo', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 258),
('15', 'San José', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 259),
('16', 'Santa Rosa de Lima', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 260),
('17', 'Yayantique', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 261),
('18', 'Yucuaiquín', '14', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 262);
Reply

#6
Draven, Why do you ask me this in private? Use the public forum.   Dodgy
Also I couldn't reply, you have disabled PM! 
Reply

#7
And Abrkof, come on!! Don't post huge chunk of code like that! At the very least, use the code tag.
Reply

#8
Can you confirm your ajax request return the expected data? With firebug you can see if your ajax request is really called and what gets returned.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.