Using Script Tags As Data Contains In AJAX-Powered jQuery

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>jQuery And Script Tags With AJAX-Table Data</title>
	<script type="text/javascript" src="jquery-1.3.2.js"></script>
	<script type="text/javascript">
 
		// When the DOM has loaded, gather the table data.
		$(
			function(){
				$.ajax(
					{
						method: "get",
						url: "./scripts_data.cfm",
						dataType: "html",
						success: populateTable
					}
					);
			}
			);
 
 
		// I take the AJAX response and populate the table with
		// initailized records.
		function populateTable( strHTML ){
			var jTable = $( "#table" );
 
			// Append raw HTML to the table. We can initialize the
			// html data after we append it.
			//
			// NOTE: After we append the HTML, the Script tags
			// will have been stripped out and placed at the
			// bottom of the table!
			jTable.append( strHTML );
 
			// Log table HTML for demo.
			console.log( jTable.html() );
 
			// Bind the meta data (remember, script tags became
			// children of the table itself).
			jTable.find( "> script.metadata" ).each(
				function( intI, objScript ){
					var jThis = $( this );
					var jRow = $( "#" + jThis.attr( "rel" ) );
 
					// Bind the meta data to the row.
					jRow.data(
						"metadata",
						eval( "(" + jThis.html() + ")" )
						);
				}
				);
 
			// Gather records.
			var jRows = jTable.find( "tbody > tr" );
 
			// Now that the meta data is bound to the record,
			// let's hook up the row action links.
			jRows.find( "a.delete" )
				.attr( "href", "javascript:void( 0 )" )
				.click(
					function( objEvent ){
						var jRow = $( this ).parents( "tr:first" );
 
						// This doesn't really do anything - just
						// for demonstration purposes. Showing
						// how we can grab meta data from the row.
						confirm(
							"Are you sure you want to delete " +
							jRow.data( "metadata" ).name +
							" from the table?"
							);
 
						// Prevent default event.
						return( false );
					}
					)
			;
		}
 
	</script>
</head>
<body>
 
	<h1>
		jQuery And Script Tags With AJAX-Table Data
	</h1>
 
	<table id="table" cellspacing="1" border="1" cellpadding="5">
		<thead>
			<tr>
				<th>
					ID
				</th>
				<th>
					Name
				</th>
				<th>
					Actions
				</th>
			</tr>
		</thead>
 
		<!--- Table data will loaded via AJAX. --->
	</table>
 
</body>
</html>

For Cut-and-Paste