ajax调用

前端之家收集整理的这篇文章主要介绍了ajax调用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
$("#btnOK").click(function() {
            $.ajax({

                url:'接口地址',type:'GET',//GET
                async:true,//或false,是否异步
                timeout:5000,//超时时间
                dataType:'json',//返回的数据格式:json/xml/html/script/jsonp/text
                beforeSend:function(xhr){
                    console.log(xhr)
                    console.log('发送前')
                },success:function(data,textStatus){
                    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('结束')
                }
            })
        });

【statustext no transport】问题

原文链接:https://www.f2er.com/ajax/160637.html

猜你在找的Ajax相关文章