日期:2014-05-16  浏览次数:20681 次

ajax 通过 IP得到国家名称...
我想通过通过 IP得到国家名称,用ajax实现:一下是我实现的代码,哪位大虾帮忙看看..进不了..获取不到对应的值(要的是英文国家的名称,地址就是我给出的这个),一下是代码,
function getaddress(ips) {
    var idds;
    $.ajaxSetup({ async: false });
    $.get("http://api.hostip.info/country.php", { ip: ips },
                                                      function(data) {

                                                          if (data.toString().IndexOf("XX") > -1) {
                                                              idds = ipads;
                                                          } else {
                                                              idds = data;
                                                          }
                                                      });
        $.ajaxSetup({ async: true });                                            
    return idds;
}
谢谢大家哈....