且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用.get使用jquery从外部URL获取内容

更新时间:2022-05-07 22:30:58

(document).ready(function(){
// this代码工作顺利
(document).ready(function(){ //this code is working smooth


(button)。click(function(){
("button").click(function(){


.get(demo_test.asp,function(data) ,状态){
alert(数据:+数据+\ nStatus:+状态);
});
});
});
< / script>
< / head>
< body>

< button>向网页发送HTTP GET请求并返回结果< / button>

< / body>
< / html>
.get("demo_test.asp", function(data, status){ alert("Data: " + data + "\nStatus: " + status); }); }); }); </script> </head> <body> <button>Send an HTTP GET request to a page and get the result back</button> </body> </html>





我尝试过:





What I have tried:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
//this code is not working