I get lost on how to query my Amazon CloudSearch from a static HTML page. Although the documentation is good, there are no examples besides copying and pasting the URL in the browser.
What I need is an S3 HTML page, so the server side code is not allowed to have a text box that, when the search button is clicked, launches at my CloudSearch endpoint and returns the results
CloudSearch responds using JSON, so you have to analyze this and compile a table of results.
So far I have been working with saved JSON of results locally and using Jquery I read JSON file
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>JSON Sample</title> </head> <body> <div id="placeholder"></div> <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script> $.getJSON('search.json', function(data) { var output="<ul>"; for (var i in data.hit) { output+="<li>" + data.hit[i].id+ "</li>"; } output+="</ul>"; document.getElementById("placeholder").innerHTML=output; console.log(data); }); </script> </body> </html>
This gives me the post id.
But when I try to change the URL at the CloudSearch endpoint, I do not return data. After reading and going around in circles, I believe that this is because of CORS.
However, the Amazon documentation just says use HTTP GET on the endpoint, but how can I create it on my HTML page.
Sorry for such a basic question
source share