jQuery-异步请求

load(url,[data],callback)

载入远程 HTML 文件代码并插入至 DOM 中。

url:待装入 HTML 网页网址。

data:发送至服务器的 key/value 数据。在jQuery 1.3中也可以接受一个字符串了。

callback:载入成功时回调函数。

PHP方面必须是HTML片段,使用面小,可以加载页头,页尾

header("Content-Type:text/html;charset=UTF-8");
?>
<hr>
<p id="copyright">版权所有© 2017-10-11</p>

jQuery.get(url, [data], [callback], [type])

url:待载入页面的URL地址

data:待发送 Key/value 参数。

callback:载入成功时回调函数。

type:返回内容格式,xml, html, script, json, text, _default。

$.get("register.php", { name: "John", time: "2pm" },
  function(data){
    alert("Data Loaded: " + data);
  });
原文地址:https://www.cnblogs.com/liangfc/p/7819873.html