码迷,mamicode.com
首页 > Web开发 > 详细

jQuery的ajax方法:

时间:2017-05-16 00:39:38      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:data   before   async   text   for   stat   on()   时间   log   

$.ajax({
    url:‘/comm/test1.php‘,
    type:‘POST‘, //GET
    async:true,    //或false,是否异步
    data:{
        name:‘yang‘,age:25
    },
    timeout:5000,    //超时时间
    dataType:‘json‘,    //返回的数据格式:json/xml/html/script/jsonp/text
    beforeSend:function(xhr){
        console.log(xhr)
        console.log(‘发送前‘)
    },
    success:function(data,textStatus,jqXHR){
        console.log(data)
        console.log(textStatus)
        console.log(jqXHR)
    },
    error:function(xhr,textStatus){
        console.log(‘错误‘)
        console.log(xhr)
        console.log(textStatus)
    },
    complete:function(){
        console.log(‘结束‘)
    }
})

jQuery的ajax方法:

标签:data   before   async   text   for   stat   on()   时间   log   

原文地址:http://www.cnblogs.com/chenyufu/p/6859005.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!