Ajax

来源:互联网 发布:mac上怎么卸载软件 编辑:程序博客网 时间:2024/05/22 06:25

一 jq中的方法

1 .get.post

    $.post(url,data,function (result) {        console.log(result)    })  

2 其实.get.post 以上是对 .ajax.ajax属于底层方法了

$.ajax({    type:"put",   // 可以使put delete get post    url:"",    async:true,    data: { dataName: dataContent},    success:function  (result) {        console.log(result);    }});

这个async是默认为 true ,表示所有的请求为异步请求 。如果需要发送同步请求,请将此选项设置为false。注意,同步请求将锁住浏览器,用户其他操作必须等待请求完成才可以执行。

data 是发送到服务器的数据 ,要求为Object或String类型的参数


0 0
原创粉丝点击