jQuery 封装的ajax

 jquery封装的ajax

具体操做:html

$.get(url  [,data]  [,fn回调函数]   [, dataType]);jquery

       data:给服务器传递的数据,请求字符串 、json对象 均可以设置ajax

       fn:回调函数,ajax请求完成后调用该函数,能够在此函数完成ajax的后续处理json

       dataType:服务器返回数据类型,html、text、xml、json缓存

       (该ajax是异步的get方式请求)服务器

 

$.post(url[,data][,fn回调函数][, dataType]);异步

       该方法与$.get()方法使用彻底一致,不一样的是其为post方式请求async

 

$.ajax({  //json对象函数

              url:请求地址,post

              data:给服务器传递的数据,

              dataType:数据从服务器返回格式html、text、xml、json

              type:get/post请求方式

              success:function(){}  ajax成功请求后的回调函数,能够作后续处理使用

              async:[true]异步/false同步,

              cache:[true]缓存/false不缓存,

}

)

相关文章
相关标签/搜索