<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Help with JSON please"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "Help with JSON please"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Help with JSON please</title>
				<description><![CDATA[ Hello

I am trying to obtain the toponymName from http://ws.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9.

Here is my code:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
$.getJSON&#40;"http://ws.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9", function&#40;data&#41;{
alert&#40;data.toponymName&#41;;
}&#41;;
</pre>
		</div>

What am I doing wrong?

Thank you.

roberto]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2073.page#8405</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2073.page#8405</link>
				<pubDate><![CDATA[Wed, 8 Sep 2010 10:48:23]]> GMT</pubDate>
				<author><![CDATA[ RobertoS]]></author>
			</item>
			<item>
				<title>Re:Help with JSON please</title>
				<description><![CDATA[ It is better to use $.ajax()  with dataType:'jsonp'

Have a  look to geotree.html :
view-source:http://geotree.geonames.org/geotree.html]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2073.page#8406</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2073.page#8406</link>
				<pubDate><![CDATA[Wed, 8 Sep 2010 11:44:56]]> GMT</pubDate>
				<author><![CDATA[ geotree]]></author>
			</item>
			<item>
				<title>Re:Help with JSON please</title>
				<description><![CDATA[ OK, this is the best I can do after spending the afternoon reverse-engineering  :roll: the sample script:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
var geonames;
function getLocation&#40;jData&#41;
{
  if &#40;jData == null&#41; {
    return;
  }
  geonames = jData.geonames;
	var placeInput = document.getElementById&#40;"placeInput"&#41;.value = jData.geonames.toponymName;
}


function placeLookup&#40;&#41;
{
  request = 'http://ws.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9&callback=getLocation';
  aObj = new JSONscriptRequest&#40;request&#41;;
  aObj.buildScriptTag&#40;&#41;;
  aObj.addScriptTag&#40;&#41;;
}</pre>
		</div>

What am I missing?

Thanks!]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2073.page#8415</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2073.page#8415</link>
				<pubDate><![CDATA[Thu, 9 Sep 2010 17:28:44]]> GMT</pubDate>
				<author><![CDATA[ RobertoS]]></author>
			</item>
			<item>
				<title>Re:Help with JSON please</title>
				<description><![CDATA[ $(function() {
    $.ajax({
        url: 'http://ws.geonames.org/findNearbyPlaceNameJSON',
        dataType:'jsonp',
				data: {
							lat: '47.3',
							lng: '9',
						},
        success:function(response) {
          alert(response.geonames.length);
	 alert(response.geonames[0]);

          }
    });
});


OK, so this is giving me an array of length 1 (good). But how do I retrieve the "toponymName"?

Thanks  for your help.

Roberto]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2073.page#8417</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2073.page#8417</link>
				<pubDate><![CDATA[Sun, 12 Sep 2010 17:29:46]]> GMT</pubDate>
				<author><![CDATA[ RobertoS]]></author>
			</item>
			<item>
				<title>Re:Help with JSON please</title>
				<description><![CDATA[ This is the power of json :
javascript data from 'response' array have exactly the same name as in the json demo output :
view-source:http://ws.geonames.org/findNearbyPlaceNameJSON?formatted=true&lat=47.3&lng=9&style=full

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
success: function&#40;response&#41; {
	// ws returns an error message
	if &#40;response.status&#41; {
		alert&#40;response.status.message+response.status.value&#41;;
	}
	// ws returns an array of data
	if &#40;response.geonames && response.geonames.length&#41; {
		$.each&#40;response.geonames, function&#40;&#41; {
			alert&#40;this.fcode&#41;;
			alert&#40;this.toponymName&#41;;
			etc...
		}
	}
} 
</pre>
		</div>
Once again, have a look to geotree.html : 
view-source:http://geotree.geonames.org/geotree.html]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2073.page#8424</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2073.page#8424</link>
				<pubDate><![CDATA[Tue, 14 Sep 2010 07:35:39]]> GMT</pubDate>
				<author><![CDATA[ geotree]]></author>
			</item>
			<item>
				<title>Re:Help with JSON please</title>
				<description><![CDATA[ Thank you. I managed to obtain the data I was looking for. 

I am testing your commercial service now! ]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2073.page#8446</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2073.page#8446</link>
				<pubDate><![CDATA[Sat, 18 Sep 2010 14:21:51]]> GMT</pubDate>
				<author><![CDATA[ RobertoS]]></author>
			</item>
			<item>
				<title>Re:Help with JSON please</title>
				<description><![CDATA[ here is a good example:http://jqueryui.com/demos/autocomplete/#remote-jsonp]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2073.page#8451</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2073.page#8451</link>
				<pubDate><![CDATA[Tue, 21 Sep 2010 10:58:21]]> GMT</pubDate>
				<author><![CDATA[ taohui]]></author>
			</item>
	</channel>
</rss>