tags:

views:

124

answers:

2

Here's the code that I've been trying to work with:

$.getJSON("http://api.remix.bestbuy.com/v1/products(search=" + escape(searchCriteria) + ")?apiKey=" + hhApiKey + "&format=json&callback=?", 
function(data) {
 if(data.error) {
  alert("I'm sorry, there was an error processing your request.");
 } else {
  alert(data);
 }
});

However, the data that comes back has an error because it doesn't understand the requested URL. I looked at the net tab in Firebug and here's the URL it's trying to call out to:

http://api.remix.bestbuy.com/v1/products%28search=digital%20camera%29?apiKey=myapikey&format=json&callback=json1264868431&_1254866270659=

I think the problem lays in the bolded section which is being added on for no reason as far as I can tell. I think the Remix API sees it and thinks it's a botched parameter. Is there any way to stop that from being added?

+2  A: 

When disabling the cache setting for jQuery ajax it will attempt to append a timestamp to the querystring. This may be the problem your experiencing. Try calling the function with caching explicitly enabled.

$.ajax({
 type: "GET",
 url: "http://api.remix.bestbuy.com/v1/products(search=" + escape(searchCriteria) + ")?apiKey=" + hhApiKey + "&format=json&callback=?",
 cache: true,
 success: function() {
  alert('success');
 },
 dataType: 'json'
});
bendewey
This was it! Setting the cache to true got rid of the variable being appended to the end of the URL and stopped the remix api from gettng screwed up! Thanks!
Chris
A: 

I've just gone to that URL and it says "403 Developer Inactive". Could you be needing to do an API developer registration to get through and is your account active?

A lot of these API requests (Netflix) require you to login in first, and it will assign you a session id to include in your querystring. Could it be you're not logged

Sorry if these seem like obvious questions, I'm just throwing some ideas out there.

Evildonald