How to: Update dialog div with new content from json

How to: Update dialog div with new content from json

I am attempting to update the div of my dialog with new content from a json array and am encountering issues and am requesting some guidance.

I output a json array which has labels for a 'Name' and a 'Definition'. A user is presented with a list of radio buttons. When a user clicks a radio button which has the following structure:
  1. <input type="radio" value="23" name="statistic" id="stat-23" />
I take the value of the radio button and use this to identify which 'Name' 'Definition' pair I am referring to from my json array.

I then use the 'Name' 'Definition' pair to populate a div which typically updates dynamically. To accomplish this I use the following code:
  1. $('input[type=radio]').live( 'change', function(){
  2.       if ( ! $(this).is(':checked') )
  3.         return false;
  4.       var stat_id = $(this).attr( 'id' ).replace( /stat-/, '' );
  5.       refreshDefinition( stat_id );
  6.       } );

  7.   function refreshDefinition( stat_id ) {
  8.       var definition = definitions[ stat_id ];
  9.       var div = $("<div id='definition'>"+definition.name+": "+definition.definition+"</div>");
  10.       $('#definition').replaceWith( div );
  11.       }
This works fine without a dialog (it updates just fine as is), however, it would look a lot better if there were some way to incorporate a dialog so that when a user clicks a button, the dialog will appear and they can see the 'Name' 'Definition' pair and then can exit out of it when they are satisfied.

If you have any guidance on how I could go about solving this problem or any alternative approaches, I would really appreciate it!

Thanks.