CORS support using search api

Hey, @jmcgloin!

JSON-P is supported on all endpoints including search. There are three problems in your code:

  1. You’re not passing the URL to $.getJSON. So, the request is going out to nowhere, which is why you’re getting Not Found. I figured this out by using the DevTools in Chrome (specifically, the network tab) to see that the response was returning a CodePen 404.
  2. Only the first query string parameter has a question mark (?) in front of it. The rest are appended using an ampersand (&). You’re currently using a question mark (?) for all of your arguments.
  3. The data being returned isn’t an array but a JSON object. You need to get the _total property of the object rather than trying to index into an array that doesn’t exist.

If you fix those three things, it’ll all work just fine. :slight_smile: I have the working code for this, but I’m going to leave it up to you to fix for the sake of learning!

Let me know if you have more questions!