mardi 21 juillet 2020

Rendering HTML from external javascript

I have a task to show my product list on my client's websites. My idea is include my JavaScript file in client's websites call a function like this,

<div id="my-product-list"></div>

<script src="https://example.com/myscript.js"></script>
    const myproducts = new Products('#my-product-list', 12323);
    myproducts .setup();
</script>

Is this the right way to achieve this?

If yes, How can I include css styles(media queries) for my elements?

If no, what is the best way to do this?




Aucun commentaire:

Enregistrer un commentaire