【发布时间】:2015-07-26 14:09:18
【问题描述】:
请帮我解决一个问题 - get 函数不适用于 http://wtfismyip.com/text 或 http://www.passwordrandom.com/query?command=ip
代码:
<span id="global_ip" class="global_ip">global ip - get test</span>
<script type="text/javascript">
$('#global_ip').click(function () {
alert('click!');
$.get({
type: "GET",
url: "http://www.passwordrandom.com/query?command=ip",
dataType: "text"
}).done(function (res) {
alert(res);
}).fail(function (jqXHR, textStatus, errorThrown) {
alert("Call failed: " + textStatus + ", " + errorThrown);
});
});
【问题讨论】:
-
你可以这样做jsbin.com/negatu/1
标签: javascript jquery ajax get ip