As your document is getting modified by Ajax, so you need to change your above click function with this:
$(document).on('click', '#trace', $.proxy(function(event) {
/****Your Code ***/
});
OR
$('#trace').live('click', $.proxy(function(event) {
/****Your Code ***/
});