conditionally call JavaScript function
<p>I have a "Pay" button where we are starting to accept credit card. I need to call a Javascript function from the server side click event. I tried with Response.Write as below but that does not trigger my function that is defined in the separate .js file. What else can I do?</p>

<pre><code>        protected void btmMakePayment_Click(object sender, EventArgs e)
        {            
            if (user selected credit card)
            {
                Response.Write("&lt;script language='javascript' type='text/javascript'&gt;OpenPayPalDialog();&lt;/script&gt;");
            }
            else
            {
                continue with the current server side logic
            }
       }
</code></pre>

<p>Thank You in advance.</p>
