News for hackers. Stuff that matters.
Re:WikiMedia's Geo IP Lookup JSONP call by crescentfresh on Sunday July 10, 2011 @03:19PM (#2748385)
The payload is not JSONP and strikes me as a bit impractical:

    Geo = { /* object literal */ }
I assume this service is meant to be consumed via <script> tag injection. Without a JSONP-style callback parameter, what are consumers to do, inject-then-poll until a "Geo" object is found in the global scope?
Re:WikiMedia's Geo IP Lookup JSONP call by judofyr on Sunday July 10, 2011 @03:23PM (#2748396)

    <script src="http://geoiplookup.wikimedia.org/"></script>
    <script>geoloaded()</script>
    </body></html>
Re:WikiMedia's Geo IP Lookup JSONP call by crescentfresh on Sunday July 10, 2011 @04:02PM (#2748482)
D'oh!
Re:WikiMedia's Geo IP Lookup JSONP call by tybris on Tuesday July 12, 2011 @04:54AM (#2754060)
The approach of dynamically generating a callback script is more robust than pure JSONP. If your URL returns an error (e.g., 404), you immediately notice, instead of waiting for the time-out. These days, my usual approach looks something like this in flight:

    <script type="text/javascript">
        var response = undefined;
    </script>
    <script type="text/javascript" src="...">
       // response = { .... };
    </script>
    <script type="text/javascript">
       _callbacks[1234](response); // response == undefined means error
       response = undefined;       // allow garbage collection
    </script>
    
It's a bit more administration, but I really like not having to worry about dynamic callback names, delayed errors, or non-existent callback functions any more.