Create modal form dialog in function
<p>My app works with many modal form dialogs, i want to create modal form dialog by call a function, but i get error when i click OK button on dialog "i.apply is not a function". My code below</p>

<p>html: </p>

<pre><code>&lt;div id="dlg_srch_acnt"&gt;
        &lt;table cellpadding="0" cellspacing="0" border="0" class="display" id="dtl_acnt_srch" style=" padding-bottom:0px;"&gt;
            &lt;thead&gt;
                &lt;tr&gt;
                    &lt;th&gt;Id&lt;/th&gt;
                    &lt;th&gt;Account name&lt;/th&gt;
                &lt;/tr&gt;
            &lt;/thead&gt;
            &lt;tbody&gt;
            &lt;/tbody&gt;
        &lt;/table&gt;
    &lt;/div&gt;
</code></pre>

<p>Script</p>

<pre><code>function init_dlg(id, autoOpen, height, width, modal, fn_button1)
            {
                id.dialog({
                    autoOpen:autoOpen,
                    height:height,
                    width:width,
                    modal:modal,
                    buttons:{
                        'OK':fn_button1,
                    },
                    close:fn_close
                });
            }



function fn_ok()
            {
                $('#parnt_acnt').val(acnt_name);
                $('#dlg_srch_acnt').('close');
            }

init_dlg($('#dlg_srch_acnt'), false, '440', '480', true, 'fn_ok()');
</code></pre>
