By default (and for good reason), Azure Search API doesn’t allow cross-origin requests. If you are getting something like the following, then you have to configure CORS requests for your application.
Azure Search (search.windows.net) No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin is therefore not allowed access. The response had HTTP status code 400.
This is extremely easy, however a bit less-than-obvious, especially if you miss it the first time you set it up. If you’ve configured Azure Search and have it returning the results you expect in Search Explorer, but then on your machine get a origin error, you still need to set up CORS on your Index. It takes just a few clicks – but if you missed this step when setting up your Index, it isn’t obvious to find it. I keep saying ‘index’ because if you’re like me, you’ll go look on the search service to set up origins, but you need to do this on the index itself. Open your search service in the Azure Portal. Choose the index you are aiming to query.
Scroll down to the bottom of the column. Note that your index is probably set to ‘none’. We’re just going to allow all – but you can restrict it to your required hosts later using basically the same steps.