源代碼
點擊運行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>教程</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $.post("/try/ajax/demo_test_post.asp",{ name:"教程", url:"http://www.sharebody.com" }, function(data,status){ alert("數據: " + data + " 狀態: " + status); }); }); }); </script> </head> <body> <button>發送一個 HTTP POST 請求頁面併獲取返回內容</button> </body> </html>
運行結果