api不在ajax调用中工作,但在post man中工作正常

时间:2019-06-21 10:52:46

标签: ajax postman

我在邮递员中使用了Web api,并且在邮递员中工作正常,并且得到了正确的响应,但是当我将其用于ajax调用时,出现了“不允许使用405方法”。请帮我解决。谢谢

以下是我的邮递员参数:-

  

url:“ https://services-sit.wba.com/services/gbl/customers/v1/searchAddress?UUID=ea8034fe-7c81-11e9-8f9e-2a86e4085a59&Text=wr53da&IsMiddleware=True&Origin=GBR&Countries=UnitedKingdom&Limit=2&Language=ENG

     

标题:x-api-key:“ zyx”

     

方法:“获取”

================================================ ======

下面是我如何使用邮递员呼叫到ajax呼叫

$.ajax({type:'GET',
               //data:{id:'aaaaa'},
           crossDomain: true,
               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",
           headers: { 'x-api-key': 'xyz', 'Content-Type': 'application/json' },
               beforeSend: function(xhrObj){},
        success:function(data){
                            $(".loader").fadeOut('slow');
                        //var dataArray = jQuery.parseJSON(data);}
});

0 个答案:

没有答案