Reputation: 165
I am trying to make a simple get request to the ebay api and my code is returning an error only in chrome. In safari and firefox the following code returns the data as expected. Chrome gives the following error: GET about:blank net::ERR_UNKOWN_URL_SCHEME in the console.
In the network inspector I see 307 internal redirect for the get request. Followed by a request name about:blank. Inspecting the Header reveals a request URL set to about:blank.
I think my original request is redirecting to about:blank but this is only happening in chrome and I am not sure why.
$.ajax({
dataType: "jsonp",
method: "GET",
url:"https://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findCompletedItems&SERVICE-VERSION=1.7.0&SECURITY-APPNAME=RoryGarc-priceGen-PRD-55d8a3c47-c767674d&GLOBAL-ID=EBAY-US&RESPONSE-DATA-FORMAT=JSON&callback=jsonpcallback&REST-PAYLOAD&keywords=a7s+ii&itemFilter(0).name=Condition&itemFilter(0).value=3000&itemFilter(1).name=SoldItemsOnly&itemFilter(1).value=true&paginationInput.entriesPerPage=10&paginationInput.pageNumber=1",
success: function (html) {
alert('successful : ' + html);
},
error: function (jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
} else if (jqXHR.status == 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status == 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
alert('Requested JSON parse failed.');
} else if (exception === 'timeout') {
alert('Time out error.');
} else if (exception === 'abort') {
alert('Ajax request aborted.');
} else {
alert('Uncaught Error.\n' + jqXHR.responseText);
}
}
});
function jsonpcallback(jsdata) {
console.log(jsdata.findCompletedItemsResponse[0].searchResult[0].item);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Upvotes: 0
Views: 2072
Reputation: 165
I did some more digging and found the error for me was caused by a chrome extension which was causing the 307 internal redirect. I disabled it and everything worked fine.
Upvotes: 1