How to write a jQuery function with a callback that you can pass Params to?
<p>I have the following function:</p>

<pre><code>function loadProjects(pID) {

    $.ajax({
        url: myURL,
        success: function (dataJS) {###Run any supplied call back here####}
    });
}
</code></pre>

<p>I call this function like so loadProjects(1);</p>

<p>Issue is I want to be able to define a callBack function after success, and I'd like to include it when I do loadProjects(1, pong(12)). I want to be able to supply params to the callback.</p>

<p>How can I have a function accept a callback?
How can I pass a callback to that function?</p>

<p>Something like</p>

<pre><code>function loadProjects(pID, callback) {

    $.ajax({
        url: myURL,
        success: function (dataJS) {###Run any supplied call back here####}
    });
}
</code></pre>

<p>Where I could then call:</p>

<pre><code>loadProjects(22, pong(12))
</code></pre>

<p>Problem is when I try this, pong(12) is running immediately, and not later when called in the loadProjects function?</p>

<p>Ideas? Thanks</p>
