jquery有哪些交互方式,下面web建站小编给大家详细介绍一下!
1、利用load实现交互
$("id").load("xx.txt",function(responseTxt,statusTxt,xhr){
  if(statusTxt=="success"){
    console.log("成功");
  }
  if(statusTxt=="error"){
    console.log("失败:"+xhr.status+":"+xhr.statusTxt);
  }
});
2、利用post实现交互
$.get("/json/index", {
  name:"xiaomi",
  sex:'男'
}, function(data, status) {
  console.log(data + ":" + status);
});
3、利用get实现交互
$.get("xx.txt",null,function(data,status){   
  console.log(data+":"+status);
});
4、利用getJSON实现交互
$.getJSON("/json/index", {
  name:"xiaomi",
  sex:'男'
}, function(json) {
  console.log(json.name);
});
5、利用jQuery.ajax()实现交互
$.ajax({
  url : "/json/index",
  type : "post",
  async : true,
  dataType : "json",
  data : {
    name:"xiaomi",
    sex:'男'
  },
  success : function(result) {
    console.log(result.name)
  },
  error : function(xhr) {
    console.log("错误提示: " + xhr.status + " " + xhr.statusText);
  }
});
上面是“jquery关于交互的几种方式”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_2987.html
workflows工作流
穿着蘑菇帽的小蚂蚁探险家ComfyUI工作流
一个白色的咖啡杯,蒸汽从杯子里冒出来
水晶玉雕巨龙ComfyUI工作流
一只可爱的猫骑着一匹可爱的马ComfyUI工作流
一只蚊子被嵌在琥珀中ComfyUI工作流
一个红头发明亮眼睛的漂亮女人
一只黑色的小猫在童话森林里嗅着一朵发光的外星花
五彩斑斓的蛇状飞鸟
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

 纯CSS饼图效果
 canvas空间文本射线
 纯css制作卡通头像(随鼠标转头)
 js实现下雪特效
 纯css3绘制的小鸟
 css3动画loading效果
 js实现table表格动态新增行和列表
 css3做一个风雨雷电天气动态图标










