ajax的出现彻底改变了javascript命运,通过ajax可以直接向服务器提交数据,有两种方式:

get方式,数据直接拼接在地址中
post方式,数据由data字段携带

post方式,data中是参数。

    $.ajax({
        url:"http://localhost/contact2/user/list.do",
        type:"post",
        dataType:"json",
        data:"username=王&order=desc",
        success:function(data){
            alert("11");
        }

    });

get方式,数据在地址栏中:

    $.ajax({
        url:"http://localhost/contact2/user/list.do?username=zhangsan",
        type:"post",
        dataType:"json",
        success:function(data){
            alert("11");
        }

    });

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2021-12-29
  • 2022-12-23
  • 2021-09-29
  • 2021-12-16
猜你喜欢
  • 2021-10-31
  • 2022-12-23
  • 2021-12-07
  • 2021-11-23
  • 2022-12-23
相关资源
相似解决方案