从交叉域获取当前城市

时间:2014-03-23 17:39:38

标签: jquery ajax

我有这个脚本

$.ajax('[http://geoiplookup.wikimedia.org][1]', {
                crossDomain:true,
                success:function(data,text,xhqr){
                    var geoJSON;
                    geoJSON = data.split('=')[1];

                    geoJSON = $.parseJSON(geoJSON.substring(0, geoJSON.length -1));
                    $('body').append("<input type='text' value='"+geoJSON['city']+"' class='whereAmI'>");
                },
                error:function(jqXHR, textStatus){
                    console.log(textStatus);
                }
            });

我需要的是将 city this link输入到输入中。 控制台显示200但红色和 回复是空的

请帮忙! 谢谢!

0 个答案:

没有答案
相关问题