ajax 关于IP地址查询的API
2021-05-07 09:26
标签:add color 响应 格式 jquery enter 而不是 语言 action http://apis.baidu.com/apistore/iplookupservice/iplookup?ip=你的ip‘ headers = {"apikey": "5292d6abaf0ec95c2b7924551e50668f"}; ajax 关于IP地址查询的API 标签:add color 响应 格式 jquery enter 而不是 语言 action 原文地址:http://www.cnblogs.com/benpaodegegen/p/7648815.htmlform {
border: 1px solid #467;
border-radius: 5px;
font: 14px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
overflow: hidden;
padding:10px;
width:300px;
color:#456;
margin:15px;
}
div{
margin:15px;
color:#346;
}
button{
display:inline-block;
padding:6px 12px;
margin-bottom:0;
line-height:1.4;
text-align:center;
cursor:pointer;
border-radius:4px;
border:1px solid transparent;
color:#fff;
background:#1aba9c;
}
input{
display: inline-block;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
-webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
/*Javascript代码片段*/
$(function(){
$("form").submit(function(e){
e.preventDefault();
var ip=$("#iptext").val(),
headers = {"apikey": "5292d6abaf0ec95c2b7924551e50668f"};
url="http://apis.baidu.com/apistore/iplookupservice/iplookup?ip="+ip;
$.ajax({
url:url,
method: "GET",
headers: headers,
dataType: "json",
success: function(data){
var info=data.retData;
$.each(info,function(key,value){
$("div").append(key+":"+value+"
");
});
}
})
});
});
AJAX技术
关于IP地址查询的API
请求后对数据的处理
");