I will comment first on the idea of the project and then on what little I have achieved so far. I have an excel where I have movie names, the idea is to automatically browse the file and go looking for the covers of these films and store the name and address of the image in a table. I know how to read the excel file and go through all the rows, retrieve the name in a variable and store it in a table, all through php. I know how to go through my temporary table, make an insert or an update. I use the api of " link " to search the data in this case I only want the cover, using jquery I made the order by ajax and retrieve the data that I want. But even having all these tools do not know how to go through each "name" perform the search with ajax, in case of recovering the cover then I will perform an update of my table where I will now have the location. So that it does not depend on a click, my php file has the following
<?php
//Voy a recibir el nombre a buscar
$pelicula = isset( $_POST[ 'pelicula' ] ) ? $_POST[ 'pelicula' ] : "xmen";
echo "<div id='busco'>$pelicula</div>";
?>
<!-- Aqui muestro la caratula solo para saber que funciona -->
<div id="response-container"></div>
and initially I have
$( document ).ready( function () {
var query= $("#busco").text();
$.ajax({
data: {"api_key" : "miapi", "query" : query},
type: "GET",
dataType: "json",
url: "https://api.themoviedb.org/3/search/movie?",
}).done(respuesta);
function respuesta(data){
if (data.total_results > 0){
var output = "<img src=https://image.tmdb.org/t/p/w500"+data.results[0]['poster_path']+" width='300' height='300' data-toggle='tooltip' data-placement='top' data-html='true'>"
$("#response-container").html(output);
}
}
});
</script>
I know it's a fool to have all this but it does not give me the head to fit the pieces