不允许405方法

时间:2019-07-18 09:10:40

标签: ajax

我正在尝试ajax调用,但是它给的405方法不允许错误。请让我知道如何解决此问题。如果我删除contentType,有时会出现401错误。

ajaxReqA = jQuery.ajax({
        async: true,
        crossDomain: true,
        contentType: "application/json; charset=utf-8",
        type: "POST",
        url:"https://services-sit.wba.com/services/gbl/customers/v1/searchAddress?UUID=ea8034fe-7c81-11e9-8f9e-2a86e4085a59&Text=wr5 3da&IsMiddleware=True&Origin=GBR&Countries=United Kingdom&Limit=2&Language=ENG",
        //url: '<?php echo html_entity_decode(StoreWithKeyword."api/v1/stores?keyword=dublin&channel=1&locale=en-IE");?>',
          headers: {
            'Authorization': 'CIhhgSS4VkpMRp00oacWJILbK7vwU2xi',
            'Access-Control-Allow-Origin': '*'
        },
     //data: data,
      dataType: 'json',
      beforeSend: function() { 
        if(ajaxReqA != 'ToCancelPrevReq' && ajaxReqA.readyState < 4) {
            ajaxReqA.abort();
        }


        },
      success: function (response) {






    },
      error: function(jqXHR, textStatus, errorThrown) {
               console.log(textStatus, errorThrown);
            }
    });

0 个答案:

没有答案
相关问题