jquery ajax post says xxx not allowed by Access-Control-Allow-Origin

后端 未结 3 1711
难免孤独
难免孤独 2021-01-14 16:43

I was trying to call eBay FindProducts API using AJAX (post request) but was stuck at the following error:

XMLHttpRequest cannot load htt

3条回答
  •  孤独总比滥情好
    2021-01-14 16:58

    I finally got thi to work by doing 2 things, Thanks to Albin.

    I changed to dataType:'jsonp' added jsonp:'callbackname'. Because jQuery by default calls the callback parameter callback, but eBay expect it to be called 'callbackname'. XML was not working due to CRO problem with eBay(need to confirm though.)

    Used the chrome console to debug the object retreived, converetd to string using JSON.Stringify().

    Hope this helps somebody!

    Cheers, Rajesh

提交回复
热议问题