# Render modal from theme client-side plugin API

**URL:** <https://meta.discourse.org/t/render-modal-from-theme-client-side-plugin-api/94305>\
**Category:** Product Support\
**Created:** [August 9, 2018, 12:02pm UTC](https://meta.discourse.org/t/render-modal-from-theme-client-side-plugin-api/94305 "2018-08-09T12:02:33Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![warlof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/warlof/32/110170_2.png) [@warlof](https://meta.discourse.org/u/warlof)\
**Post date:** [September 2, 2018, 10:34am UTC](https://meta.discourse.org/t/render-modal-from-theme-client-side-plugin-api/94305/5 "2018-09-02T10:34:16Z")

</div>

Hey Joe,

I’m interested by this feature too. I’ve been able to build most of the script using your example but I don’t know how to build a specific modal ?

As far as I understand, the showModal thing is loading a template ?

Here is what I did :

```plaintext
<script type="text/discourse-plugin" version="0.8.24">
    const showModal = require("discourse/lib/show-modal").default;
    
    // EvE Online Magic SDE
    api.decorateCooked(function(cooked){
        SDD.LoadMeta()
        .then(function(arg){
            return arg.source.GetTable('invTypes').Load();
        })
        .then(function(arg){
            cooked.find('a[href="#evesde"]').each(function(){
                var typeName = $(this).text();
                
                results = _.filter(arg.table.data, function(entry) {
                    return entry[arg.table.c.typeName] === typeName;
                });
                
                if (results.length > 0) {
                    $(this).attr('data-typeid', results[0][arg.table.c.typeID]);
                    $(this).on('click', function(){
                        console.debug('show modal');
                        showModal('eveSdeModal');
                    });
                }
            });
        });
    });
</script>

```

---

_[View the full topic](https://meta.discourse.org/t/render-modal-from-theme-client-side-plugin-api/94305)._
