GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Wie komme ich an die Daten aus dem Array  XML
Forum Index -> Forum in Deutsch
Author Message
vincent2256



Joined: 07/09/2013 23:15:03
Messages: 1
Offline

Hallo,

ich bin neu in dem Gebiet und bräuchte etwas Hilfe.
Ich habe hier einen Teilauszug meines jQuery Codes.

Code:
 ...
 var myGeoCode = Array(
 	'http://api.geonames.org/postalCodeSearchJSON?postalcode={zip}&country={code}&maxRows=1&style=short&username=demo&callback=getLocation'
 );
 
 ...
 
 if ( zip && country_code ) {
 	var url = myGeoCode[0].replace('{zip}', zip).replace('{code}', country_code.toLowerCase());
 	$.getJSON(url);
 }
 
 ...
 
 var getLocation = function(response) {
 	if (response && response.postalCodes[0].lat && response.postalCodes[0].lng)
 	{
 		$('#stage').append('<p> LAT: ' + response.postalCodes[0].lat + '</p>');
 		$('#stage').append('<p> LNG: ' + response.postalCodes[0].lng + '</p>');
 	} else {
                 $('#stage').append('<p>Fehler: PLZ nicht bekannt!</p>');    
 	}
 };
 


Die Anfrage wird nachdem ich in einem Formular die zip und den country_code angegeben habe ausgeführt.
Das kann ich auch anhand von Firebug einsehen. Soweit so gut.
Jedoch wird die callback funktion nicht ausgeführt und ich sehe auch keine Daten.

Für eine Lösung meiner Problematik wäre ich sehr dankbar!
Ich kenne mich mit jQuery und Geoname nicht so aus.

Vielen Dank
Vince
 
Forum Index -> Forum in Deutsch
Go to:   
Powered by JForum 2.1.5 © JForum Team