1 year ago

#358235

test-img

Dango

ParsIng BIng Image Search using JQuery or Javascript Errors

I can successfully parse Bing Search JSON API correctly. Using Version 7 of both Web Search and Images. For some reason JSONLint is correct for images but but can not parse a damn thing. My JQuery code is below Thanks in advance!

 ////JQUERY CODE
  $(document).on("click", "#i-search", function () { 

 //API URL
 var uri  = 'bing-img.php';

//SEARCH PARAMETERS
var e = escape($('#book').val());
var pg = escape($('#pg').val());;
var limit = escape($('#limit').val());;
var market = "en-us";


  $.ajax({

  url: uri,
  method: "GET",
  data: { q:e, s:limit, p:pg, m:market },
  success: function(data) {

  var obj = JSON.parse(data)

  //SEARCH RESULTS
  var ocean = obj.value; //client prop is an array

  for(var i = 0; i < ocean.length; i++){
 
 //alert(ocean[i].thumbnail);

 var ocean_format = '<p><a href="' + ocean[i].thumbnailUrl + '" class="cLink"'  + ocean[i].name + '">' + ocean[i].name +'</a></p>';

 $("#bookout").append(ocean_format);

        }//END SEARCH RESULTS


    $("#moreout").html(more);

    },

    error: function() {
   // console.log(data);
  }
});

}); //END IMAGE SEARCH SUBMIT  

/////// VALID BING IMAGE JSON //////////// https://0ct0p.us/bing-img.php?q=mazda&s=2&p=0&m=en-us

/////CROSS ORGIN ERROR ON FIREFOX https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin

javascript

jquery

json

api

bing

0 Answers

Your Answer

Accepted video resources