question

sincyber01 avatar image
0 Likes"
sincyber01 asked ·

Shipping API error

It has error. How can i work this Api. XMLHttpRequest cannot load http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=X…862&siteid=0&version=515&ItemID=331633600730&IncludeSelector=ShippingCosts. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. $.ajax( { url : " http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML≈pid=DSCNS2cf4-34a4-4921-a079-6b7239ba862&siteid=0&version=515&ItemID=331633600730&IncludeSelector=ShippingCosts";, type : 'get', data : '', dataType : 'xml', beforeSend : function() { alert( ' '); }, success : function( result ) { alert( 'SUCCESS' ); }, error : function( result ) { alert( 'ERROR' ); }, complete : function() { alert( 'FINISH' ); } });
shippinggetsingleitem
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

clickimusprime avatar image
0 Likes"
clickimusprime answered ·
You need to monitor errors. Your code is getting a cross-domain policy error because you are trying to load XML. You need to use JSONP to do it this way or setup a server-side proxy to fetch the eBay data and call that from your javascript. $.ajax( { url : " http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=JSON≈pid=DSCNS2cf4-34a4-4921-a079-6b7239ba862&siteid=0&version=515&ItemID=331633600730&IncludeSelector=ShippingCosts&callbackname=jsonpcallback";, type: "GET", dataType : 'jsonp' }); function jsonpcallback(json) { $("#output").html(json.Item.Title); }
· 1 · Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you very much. It's working now!!!!!!
0 Likes 0 · ·
sincyber01 avatar image
0 Likes"
sincyber01 answered ·
URL is ok. It has error with that source. may be worng method or I get some mistake with that source. I want find another way to use this Api. http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML≈pid=MyAppID&siteid=0&version=515&ItemID=331633600730&IncludeSelector=ShippingCosts
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

helios825 avatar image
0 Likes"
helios825 answered ·
I don't know AJAX, but I took the API call URL from your code, swapped in my AppID, and it ran fine in my browser.
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.