$.getJson reuse method for rendering 2 different controls
<p>getJson call which I want to be able to reuse for different ui rendering.
I want to use the GetUserRoles(userName) method for rendering 2 ui controls with 2 different calls.  The first call is made to populate a dropdownlist.  Now I want to make another call to the method which will draw a UL list on the same page.  How do I do it using the same method.</p>

<pre><code> function GetUserRoles(userName) {
            var param = { userName: userName };
            $.getJSON(userRoleController, param, function (data) { GetUserRolesSuccess(data, userName); });
        }

        function GetUserRolesSuccess(data,userName) {
            $("#userdetails #roles").html("");
            if (data.length != 0) {
                var roles = "&lt;table class='rolesTable' cellpadding='0' cellspacing='0' border='0'&gt;";
                for (var i = 0; i &lt;= data.length - 1; i++) {
                    if (data[i] != undefined) roles += "&lt;tr&gt;&lt;td&gt;" + data[i] + "&lt;/td&gt;&lt;td&gt;&lt;a href='#' onclick=\"RemoveUserFromRole('" + data[i] + "','" + userName + "');\"&gt;Remove&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";
                }
                roles += "&lt;/table&gt;";
            }
            else {
                roles = "&lt;p class='norolesavailable'&gt;No roles assigned to user.&lt;/p&gt;";
            }

            $("#userdetails #roles").html(roles); 
        }
</code></pre>
