加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

jquery中页面Ajax方法$.load的功能使用介绍

发布时间:2020-12-15 23:33:52 所属栏目:百科 来源:网络整理
导读:load语法 $(".selector").load("url",function(responseText,statusText,xmlhttprequest)); 可以做到加载一个页面的时候,如果发生错误,根据statusText给出的状态,显示对应的提示,这对用户来说非常重要。 例子,load post 代码如下 代码如下: 点击我 内容

load语法

$(".selector").load("url",function(responseText,statusText,xmlhttprequest));

可以做到加载一个页面的时候,如果发生错误,根据statusText给出的状态,显示对应的提示,这对用户来说非常重要。

例子,load post

代码如下

代码如下:
点击我
内容加载中

$("#btnAjaxPost").click(function(event) { var username = $("#username").val(); //发送Post请求 $("#divResult").load("$(www.52php.cn){ctx}/jqueryLoad",{ "username": username}); }); 例子,load get方法

代码如下

代码如下:
内容加载中