none
was CORS enabled for new bing api ( Azure) ?

    Question

  • This is my jquery code , while running I am getting a error "XMLHttpRequest for https://api.datamarket.azure.com/Data.ashx/Bing/Search/Web/?Query=%27leo%20fender%27&Market=%27en-US%27 required Cross Origin Resource Sharing (CORS). " I gone through forums, I read that there is some problems with CORS with new bing api, is problem solved ? 

          $(function(){
    
                var appKey ="mykey";
                var defaultUrlBase = "https://api.datamarket.azure.com/Data.ashx/Bing/Search/Web/";
    
                var authHeader = "Basic " + btoa(appKey + ":" + appKey);            
    
                var urls = defaultUrlBase+"?Query=%27leo%20fender%27&Market=%27en-US%27";
    
                $.ajax({
                    beforeSend: function (xhr) {
                        xhr.setRequestHeader("Authorization", authHeader);
                    },
                    url:urls,
                    type:"get",
                    datatype:"json",
                crossDomain:true,
                success: function(data)
                {
                    console.log(data);
                },
                error: function(jqHXR,status,error)
                {
                    console.log("status:",status,"error:",error);
                }
            });
            });

          please help me out ........


    Mani

    Friday, February 07, 2014 1:47 PM

Answers