搜索文档
首页
HTML/CSS
JavaScript
服务端开发
Java教程
移动端
数据库
当前位置:
首页
JavaScript
jQuery 教程
jQuery Ajax
源代码
清空
点击运行
<!DOCTYPE html> <html> <title>jQuery - AJAX get() and post() 方法示例 - 基础教程(div.cn)</title> <head> <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $.post("ajax_post.php", {fname:"Seagull", lname:"Anna"}, function(data, status){ $("#output").html(data); alert(status); }); }); }); </script> </head> <body> <h2>jQuery $.post() 方法</h2> <button>获取内容</button> <div id="output"></div> </body> </html>
运行结果