return a value in javascript help needed
<p>I have this line of code:</p>



<pre class="lang-html prettyprint-override"><code>&lt;a href="#" id="profilelink" name="link2" onClick="viewornot(&lt;?php echo $freechat_id ?&gt;)"&gt;&lt;?php echo $freechat_list; ?&gt;&lt;/a&gt;
&lt;!-- call the JS onclick and if OK was click do the message box and send button here --&gt;
</code></pre>

<p>Then I have my JS:</p>

<pre><code>function viewornot(id) {
    var e = confirm('Do you want to view this profile?');
    if (e == true) {
        window.location.href = "http://www-rainbowcode-net/apps_dev.php/profiles/showprofilepersonal?id=" + id;
        window.location('http://www-rainbowcode-net/apps_dev.php/profiles/showprofilepersonal?id=' + id);
        return true;
    }
    else {
        var e2 = confirm('Do you want to send a message?');
        if (e2 == true) {
            //if ok was clicked send value back?? 
            return e2;  
        }
    }
}
</code></pre>

<p>on the e2 confirm: if I clicked OK how can I send a value back(so that I know OK was clicked) so that I can then produce the message box and send button and do the rest of the code to send a message?</p>
