News for hackers. Stuff that matters.
Re:Your IP. In JSON by lurchpop on Wednesday March 02, 2011 @04:03AM (#2278918)
add a jsonp callback option like http://jsonip.com/?callback=alert
Re:Your IP. In JSON by rburgt on Wednesday March 02, 2011 @04:14AM (#2278946)
Re:Your IP. In JSON by qixxiq on Wednesday March 02, 2011 @04:48AM (#2279013)
You should probably include the ?callback= functionality anyway. A great deal of libraries assume it will be a get variable, and cater for it specially

i.e. jQuery with http://jsonip.com/?callback=?

Re:Your IP. In JSON by NovaDesu on Wednesday March 02, 2011 @09:02AM (#2279546)
I actually made something like this a while ago.

http://demontunes.com/api/?g=ip // plain ip

http://demontunes.com/api/?g=ip&format=json // in json

http://demontunes.com/api/?g=ip&format=json&callback... // with a callback

Re:Your IP. In JSON by rburgt on Wednesday March 02, 2011 @10:16AM (#2279793)
your absolutely right, but I did not make jsonip.com

If you are using a framework for this, most of the time you are able to override callback function name, i.e. jQuery uses jsonpCallback : http://api.jquery.com/jQuery.ajax/

If not, load it manually as a script and generate a function for the callback.

Re:Your IP. In JSON by clarkevans on Wednesday March 02, 2011 @12:08PM (#2280223)
For most modern browsers, you don't need JSONP if you set the Cross-Origin Resource Sharing header, http://www.w3.org/TR/cors/