How can I assign a call back function after I query something in javascript?
<p>I typically, call this to query back the result:</p>

<pre><code>db.transaction(function(tx) {
        tx.executeSql('SELECT * FROM MyDB WHERE key = ?', [aKey], MyDB.renderResults);
});
</code></pre>

<p>and the renderResults function is like that:</p>

<pre><code>renderResults: function(tx, rs){
    // for(i = 0; i &lt; rs.rows.length; i++){
    //      document.getElementById("textfield").value = "";
    //      document.getElementById("textarea").value += rs.rows.item(i).chiChar;
    // }
}
</code></pre>

<p>But I would like to make it more flexible, I would like to assign a function as a param to renderResults, in order to make my renderResult can execute a call back function. In other words,I would like to put the commented code into a function, which the renderResults only execute the function I put .....How can I do so ?? Thank you. </p>
