I have created a file called catalogo.php
in which 2 HTML controls of type select
are found; one that shows the brand of the products, and the other that shows the products according to the selected brand.
File content catalogo.php
:
<select id="marca">
<option>Marca 1</option>
<option>Marca 2</option>
<option>...</option>
</select>
<select id="producto">
<option>Producto 1</option>
<option>Producto 2</option>
<option>...</option>
</select>
Well up to here everything is fine, now when you select a product you should load all the information (description, price, etc) into a div inside it, I did it using ajax in the same way as I did with the control select
of product and it works perfectly.
The detail is that I have a slider with the photos of the product which is not shown because the script is not executed which is in a separate file.
If I put the following tag at the end of the body of catalogo.php
:
<script src="slider"></script>
This script is going to run and as it does not find the information to which it should give operation, which would be the images loaded by the select
control, it does not produce anything even though I already bring it with ajax .
On the other hand, if I put it inside the file that makes the query and it brings all the information of the products, it would not be executed either because I understand that ajax inserts everything as a string.
My question is: is there any way to run the script and from ajax?