Origin is not allowed when trying to make jQuery ajax request to Bing Search API


  • I have had this exact code working a week ago and suddenly it stopped working. I don't think anything has changed in bing's api, I have checked my account and still have plenty of searches left. I even mimic this exact request in fiddler and it works. Here is my code:

    function queryBing(query, start, callback) {
                var requestStr = "" + query + "%27&$top=50&$format=json&ImageFilters=%27Size%3aMedium%27&Adult=%27Moderate%27";
       = true;
                    url: requestStr,
                    beforeSend: function (xhr) {
                        xhr.setRequestHeader('Authorization', 'Basic ' + accountKeyEncoded);
                    context: this,
                    dataType: "json",
                    type: 'GET',
                    error: function(e){
                    success: callback

    And its returning the following error:

    OPTIONS…$top=50&$format=json&ImageFilters=%27Size%3aMedium%27&Adult=%27Moderate%27 Origin http://localhost:81 is not allowed by Access-Control-Allow-Origin. jquery.js:8706

    XMLHttpRequest cannot load…$top=50&$format=json&ImageFilters=%27Size%3aMedium%27&Adult=%27Moderate%27. Origin http://localhost:81 is not allowed by Access-Control-Allow-Origin. 

    I have been able to query from my local computer and my website a week ago. I tried looking inside my account settings and i cant find anywhere in Bing where I would ADD my domain.

    • Edited by anthonypliu Wednesday, November 06, 2013 7:37 PM
    Wednesday, November 06, 2013 7:36 PM