[Chugalug] Any javascript guru's out there?

Joe Freeman joe at netbyjoe.com
Tue Nov 13 22:13:15 UTC 2012

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.

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.


<script type="text/javascript">

function ip_callback(json) {

        this.ip_addr = json.IP;
        this.country = json.Country;
        this.city = json.CityName;
        this.region =  json.RegionName;
        this.remote_ip = json.REMOTE_ADDR;
        this.x_forward = json.HTTP_X_FORWARDED_FOR;

// debug purposes - trigger screen pop with info
          alert("IP:" + this.ip_addr + " Region:" + this.region +"

   return this;

function onLoad() {

  var now = new Date().getTime();

  var ip_callback = new ip_callback();

// debug purposes - trigger screen pop with info
  alert("IP:" + ip_callback.ip_addr + " Region:" +ip_callback.region +"

  var params = {
        'client_region' : ip_callback.region,
        'client_city' : ip_callback.city,
        'client_ip' : ip_callback.ip_addr,


        type: "POST",
        url: "<redacted>/cgi-bin/testloadhandler.php",
        async: false,
        data: params



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://chugalug.org/pipermail/chugalug/attachments/20121113/2cb64566/attachment.html>

More information about the Chugalug mailing list