<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "States list per country?"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "States list per country?"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>States list per country?</title>
				<description><![CDATA[ Hi! First off, this service is amazing!

I was wondering if there was a way with JavaScript to send geonames.org a country iso and have it send back a list of subdivisions?

Thanks!!!
 ]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1777.page#7218</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1777.page#7218</link>
				<pubDate><![CDATA[Wed, 17 Feb 2010 20:20:12]]> GMT</pubDate>
				<author><![CDATA[ rshelby]]></author>
			</item>
			<item>
				<title>Re:States list per country?</title>
				<description><![CDATA[ Have a look at this JSONP service:
http://ws.geonames.org/childrenJSON?geonameId=3175395&callback=qwer

More on JSONP: http://en.wikipedia.org/wiki/JSONP#JSONP

This allows the broswer to directly contact the geonames webservice.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1777.page#7220</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1777.page#7220</link>
				<pubDate><![CDATA[Wed, 17 Feb 2010 23:22:14]]> GMT</pubDate>
				<author><![CDATA[ russau]]></author>
			</item>
			<item>
				<title>Re:States list per country?</title>
				<description><![CDATA[ I saw that, but you need the geonameID for that right? You can't just use "&country=US", can you?]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1777.page#7221</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1777.page#7221</link>
				<pubDate><![CDATA[Thu, 18 Feb 2010 00:48:41]]> GMT</pubDate>
				<author><![CDATA[ rshelby]]></author>
			</item>
			<item>
				<title>Re:States list per country?</title>
				<description><![CDATA[ Here's something I hacked up with jsonp and jquery:
http://tinisles.com/samples/geonames_jsonp/

The country info file will give you all the country / geonameid mappings.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1777.page#7222</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1777.page#7222</link>
				<pubDate><![CDATA[Thu, 18 Feb 2010 00:57:31]]> GMT</pubDate>
				<author><![CDATA[ russau]]></author>
			</item>
			<item>
				<title>Re:States list per country?</title>
				<description><![CDATA[ Thanks!

And I just realized why I was confused. I forgot that my local import of countries was from a different (lesser than) source!]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1777.page#7223</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1777.page#7223</link>
				<pubDate><![CDATA[Thu, 18 Feb 2010 01:30:52]]> GMT</pubDate>
				<author><![CDATA[ rshelby]]></author>
			</item>
			<item>
				<title>Re:States list per country?</title>
				<description><![CDATA[ You can use the search service if you don't have the geonameId:

view-source:http://ws.geonames.org/searchJSON?formatted=true&q=&maxRows=100&country=US&featureCode=ADM1]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1777.page#7224</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1777.page#7224</link>
				<pubDate><![CDATA[Thu, 18 Feb 2010 07:04:39]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:States list per country?</title>
				<description><![CDATA[ Awesome! One last quick question.

My code, with that URL seems to come back with all regions, not just the regions in the country I passed to geonames.

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>function get_states&#40;country_element,state_element&#41;
{
	countryElementIDHash = "#" + country_element;
	stateElementIDHash = "#" + state_element;
	$&#40;stateElementIDHash&#41;.empty&#40;&#41;;
				var geonameId = $&#40;countryElementIDHash&#41;.val&#40;&#41;;
				alert&#40;geonameId&#41;;
				$.getJSON&#40;"http://ws.geonames.org/searchJSON?formatted=true&q=&maxRows=100&featureCode=ADM1",
					{ 'country=': $&#40;countryElementIDHash&#41;.val&#40;&#41; },
					function&#40;data&#41; {
						if &#40;data.geonames == null&#41; alert&#40;'No regions'&#41;;
						$.each&#40;data.geonames, function&#40;i,item&#41;{
							$&#40;stateElementIDHash&#41;.append&#40;$&#40;'&lt;option&gt;' + item.name + '&lt;/option&gt;'&#41;&#41;;
						}&#41;;
					}
				&#41;;

}</pre>
		</div>

When I look at firebug, it does pass the correct "country=". very strange!!]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1777.page#7225</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1777.page#7225</link>
				<pubDate><![CDATA[Thu, 18 Feb 2010 16:23:38]]> GMT</pubDate>
				<author><![CDATA[ rshelby]]></author>
			</item>
			<item>
				<title>Re:States list per country?</title>
				<description><![CDATA[ Ah.. you don't need the '=' after country; e.g.

{ 'country': $(countryElementIDHash).val() },

Also I thought you need to include the "&callback=?" in the URL?  But you are seeing a result in firebug, so maybe not...
]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1777.page#7228</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1777.page#7228</link>
				<pubDate><![CDATA[Thu, 18 Feb 2010 22:43:38]]> GMT</pubDate>
				<author><![CDATA[ russau]]></author>
			</item>
	</channel>
</rss>