Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a Chrome Extension that queries the API. Using jQuery, I have the following code called from my background page:

    url: '' + id
    , success: function(data, status, xhr) { console.log(data,status,xhr); }
    , dataType: 'json'

but I keep getting null for data, even though the call is successful (I have tried substituting id for a hard-coded, existing question id, so it's not the id). Using Chrome's (underpowered) console debugger, I discovered these request headers:

Accept:application/json, text/javascript, */*
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.4 
(KHTML, like Gecko) Chrome/5.0.375.55 Safari/533.4

What am I doing wrong? If I can't make API calls from a Chrome Extension, then I've just wasted a few days of side-project programming time, which would suck...

share|improve this question
up vote 6 down vote accepted

Thanks for the help, S.Mark. Here's the answer:

You must register the API in your manifest.json file under permissions:

"permissions": [""],
share|improve this answer
+1, great, thanks for the info, @Jason. – YOU May 26 '10 at 7:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .