Here's what the EasyjQuery docs show-<div><br></div><div><pre class="bbcode_code" style="margin-top:0px;margin-bottom:0px;padding:6px;line-height:12px;border:1px inset;overflow:scroll;direction:ltr;background-image:none;background-color:rgb(242,246,248);font-size:12px;color:rgb(51,51,51);height:336px;background-repeat:repeat no-repeat">
[IP] => 93.154.204.205
[ContinentCode] => NA
[ContinentName] => North America
[CountryCode2] => US
[CountryCode3] => USA
[COUNTRY] => US
[CountryName] => United States
[RegionName] => California
[CityName] => Garden Grove
[CityLatitude] => 33.7831
[CityLongitude] => -118.0271
[CountryLatitude] => 38
[CountryLongitude] => -98
[LocalTimeZone] => America/Los_Angeles
[REMOTE_ADDR] => 77.93.210.64
[HTTP_X_FORWARDED_FOR] =>
[CallingCode] => 1
[Population] => 307,212,123 (3)
[AreaSqKm] => 9,826,675 (4)
[GDP_USD] => 14.26 Trillion (1)
[Capital] => Washington, D.C.
[Electrical] => 120 V,60 Hz Type A Type B
[Languages] => English 82.1%, Spanish 10.7%, other Indo-European 3.8%, Asian and Pacific island 2.7%, other 0.7% (2000 census)
[Currency] => US Dollar (USD)
[Flag] => <a href="http://api.easyjquery.com/proips/flags/US.jpg" target="_blank" style="color:rgb(65,115,148);text-decoration:initial">http://api.easyjquery.com/proips/flags/US.jpg</a></pre><br><div class="gmail_quote">
As I said, the alert in the ip_callback function shows valid data, so I think I'm parsing out the json correctly. It's a question of how do I get the data out of the callback function into the onLoad function, I think.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">On Tue, Nov 13, 2012 at 5:16 PM, Randy Yates <span dir="ltr"><<a href="mailto:lpcustom@gmail.com" target="_blank">lpcustom@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What does the json look like coming back from the request?<div class="gmail_extra"><br><br><div class="gmail_quote"><div>
<div class="h5">On Tue, Nov 13, 2012 at 5:13 PM, Joe Freeman <span dir="ltr"><<a href="mailto:joe@netbyjoe.com" target="_blank">joe@netbyjoe.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">In making my first foray into javascript, I've run into an issue- I'm using EasyjQuery_Get_IP() to get the client ip and some basic geo-location into, which I think pass back using an ajax post to a php script on the server that writes the data to a mysql database.<div>
<br></div><div>Inside the ip_callback function, my debug screen pop shows the correct output. The screen pop in the onLoad() function, however, doesn't show the correct output - it shows all my variable contents as "undefined". I'm obviously missing something simple and basic to javascript here, so I'm hoping someone can help me out.</div>
<div><br></div><div>Thanks-</div><div>Joe</div><div><br></div><div><div><script type="text/javascript"></div><div><br></div><div>function ip_callback(json) {</div><div><br></div><div> this.ip_addr = json.IP;</div>
<div> this.country = json.Country;</div><div> this.city = json.CityName;</div><div> this.region = json.RegionName;</div><div> this.remote_ip = json.REMOTE_ADDR;</div><div> this.x_forward = json.HTTP_X_FORWARDED_FOR;</div>
<div><br></div><div><br></div><div>// debug purposes - trigger screen pop with info </div><div> alert("IP:" + this.ip_addr + " Region:" + this.region +" City:"+this.city);</div><div>
<br></div><div> return this;</div><div>}</div><div><br></div><div>function onLoad() {</div><div><br></div><div> var now = new Date().getTime();</div><div> </div><div> var ip_callback = new ip_callback();</div><div> EasyjQuery_Get_IP("ip_callback","full");</div>
<div> </div><div>// debug purposes - trigger screen pop with info</div><div> alert("IP:" + ip_callback.ip_addr + " Region:" +ip_callback.region +" City:"+ip_callback.city);</div><div><br></div>
<div> var params = {</div><div> 'client_region' : ip_callback.region,</div><div> 'client_city' : ip_callback.city,</div><div> 'client_ip' : ip_callback.ip_addr,</div><div><br>
</div><div> };</div><div><br></div><div> $.ajax({</div><div> type: "POST",</div><div> url: "<redacted>/cgi-bin/testloadhandler.php",</div><div> async: false,</div><div> data: params</div>
<div><br></div><div> });</div><div><br></div><div>}</div><div><br></div><div></script></div></div>
<br></div></div>_______________________________________________<br>
Chugalug mailing list<br>
<a href="mailto:Chugalug@chugalug.org" target="_blank">Chugalug@chugalug.org</a><br>
<a href="http://chugalug.org/cgi-bin/mailman/listinfo/chugalug" target="_blank">http://chugalug.org/cgi-bin/mailman/listinfo/chugalug</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Google reads my email!<br>
</font></span></div>
<br>_______________________________________________<br>
Chugalug mailing list<br>
<a href="mailto:Chugalug@chugalug.org">Chugalug@chugalug.org</a><br>
<a href="http://chugalug.org/cgi-bin/mailman/listinfo/chugalug" target="_blank">http://chugalug.org/cgi-bin/mailman/listinfo/chugalug</a><br>
<br></blockquote></div><br></div>