其他分享
首页 > 其他分享> > 使用Ajax的发送Get请求,Url被截断

使用Ajax的发送Get请求,Url被截断

作者:互联网

static request(param){

        let opt = param || {};
        opt.url = param.url || '';
        opt.async = param.async || true;
        opt.data = param.data || null;
        opt.success = param.success || function () {};

        let requestUrl = opt.url;
        requestUrl = this.appendGetParams(requestUrl, opt.data);
        requestUrl = encodeURI(requestUrl);

        $.ajax({
            url: requestUrl,
            contentType: 'application/x-www-form-urlencoded;charset=utf-8',
            type:"get",
            // xhrFields:{
            //     withCredentials:true
            // },
            dataType: opt.dataType || 'json'
        }).done(function (data) {
           ...
           ...
           ...
        });
    }

标签:opt,Get,Url,requestUrl,param,url,Ajax,data,encodeURI
来源: https://blog.csdn.net/XJYPC/article/details/122038619