jquery ajax 的用法

jqueryajax请求的主要参数

beforeSend:发送ajax请求之前

success:发送ajax请求成功

error:发送ajax请求错误,通常是网络失去连接、服务器出错、后台方法错误等造成的

代码:

    $(function()
    {
        $.ajax(
        {
            url:location.href,
            dataType:'json',
            type:'post',
            data:{action:'_yundanran-all-cat'},
            beforeSend:function()
            {
                console.log('beforeSend');
            },
            success:function()
            {
                console.log('success');
            },
            error:function()
            {
                console.log('error');
            },
            complete:function()
            {
                console.log('complete');
            }
        });
    });

 

posted @ 2017-02-09 09:52  侠岚之弋痕夕  阅读(128)  评论(0编辑  收藏  举报
Where is the starting point, we don't have a choice, but the destination where we can pursue!