简体   繁体   中英

http://api.easyjquery.com/ips/ didn't retern value

HTML:

<div class=iplookup>23.25.49.250</div>;
<div class=iplookup>188.2.50.62</div>;

jQuery:

$("div").mouseup(function () {
    IP = $(this).text();
    $.getJSON("http://api.easyjquery.com/ips/", {
        IP: IP
    }, function (data) {
        alert("XXX");
        alert(data.continentName + "\n" + data.countryName + " " + data.cityName);
        $(this).append("=" + data.countryName + "," + data.cityName);

    });

});

What is wrong with this code? Why isn't the alert() shown?

The service is not returning JSONP, which you need for cross domain calls. See here for similar issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM