javascript - jQuery $.get not working (Not Found 404) -


please me problem - get function not working http://wtfismyip.com/text or http://www.passwordrandom.com/query?command=ip

code:

<span id="global_ip" class="global_ip">global ip - 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);     }); }); 

you cannot this, it's violation of same origin policy.

due browser security restrictions, "ajax" requests subject same origin policy; request can not retrieve data different domain, subdomain, port, or protocol.

but achieve want: get ip address javascript


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -