views:

62

answers:

1

Hi,

I'm trying to access the API at http://boo-box.com/api/format:json/aff:mercadolivreid/uid:173091/tags:my-query/jsonp:callback. It works fine if I try to wget it, or from my browser. But if I try to do:

function getProducts() {
  var query = encodeURIComponent(document.getElementById('query_input').value);

  url = 'http://boo-box.com/api/format:json/aff:mercadolivreid/uid:173091/tags:' + query + '/jsonp:?';
  $.getJSON(url, function(data) {
              alert(data);
            });
}

I get a null return. Looking into Firebug, I saw that the GET request returned "302 Moved Temporarily".

The move is in the same domain. Googling for it, some people says that AJAX should accept the redirect with no problems, but it isn't working.

Any ideas?

+1  A: 

Hi,

it's not a problem of the redirect, there is an error in the URL.

Try this:

url = 'http://boo-box.com/api/format:json/aff:mercadolivreid/uid:173091/tags:' + query + '/jsonp:=?';
Dr.Molle
Thanks! You are right.
Vítor Baptista