Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/02/2011, 17:56
CazadorX
 
Fecha de Ingreso: febrero-2011
Mensajes: 4
Antigüedad: 13 años, 2 meses
Puntos: 0
Pregunta Ayuda con formulario de Geoname

Hola amigos estoy estancado con un formulario que pretende automagicamente y cargando la ubicacion de un usuario.
Llego a conseguir eso pero al enviar por un formulario no recibo los datos esperados.
aqui pego el codigo.

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<
title>Geonames Global lookup</title>
<
script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    
    $.getJSON("http://ws.geonames.org/countryInfoJSON?callback=?", 
    function(data) {
        $.each(data.geonames, function(i, country) {
            
            $('select#countries').append('<option value="' + country.geonameId + '">' + country.countryName + '</option>');
        });
        $('select#countries').change(lookUpDependants);
        $('select#countries').attr('disabled', '');
        $('select#countries').attr('style', '');
    });

    
});

function lookUpDependants() {
                
    $(this).parent().nextAll('div.select').fadeOut('normal', function(){$(this).remove()});
    

    newContent = $('<div>Cargando...</div>');
    
    $('div#container').append(newContent);
                    
    $.getJSON('http://ws.geonames.org/childrenJSON?geonameId=' + $(this).val() + '&callback=?', function(data){
        
        if(data.totalResultsCount > 0) {
        
            replaceingContent = $('<div class="select"><select class="child"/></div>');
        
            $.each(data.geonames, function(i, child) {
                
                replaceingContent.children('select').append('<option value="' + child.geonameId + '">' + child.name + '</option>');
                
            });
            newContent.replaceWith(replaceingContent);
            
            $('select.child').change(lookUpDependants);    
            
        }
        
        newContent.fadeOut('normal', function(){$(this).remove()});
        
    });
}

</script>
</head>

<body>

<form method="post" name="geo" action="procesar.php" style="background-color: fuchsia;" >
    <fieldset>
<div id="container">
    
    <div class="select">
    
        <select name="geo" id="countries" disabled"></select>
            
    </div>
    
</div>
<input type=submit value="Enviar"> 
</fieldset>
    </form>

</body>
</html>