I am a new user to jQuery and am struggling trying to pass php variable to jQuery. I am using a checkbox in a while loop so because there can only be 1 id, I suffixed the id with $ticket, ie; id="check$ticket". I need to get this value in jQuery for processing. After hours of trying to figure it out, I throw myself at the experts to show me the way. I would be grateful if someone could point out my error or correct my code to grab this value. Thanks

PHP Code

PHP Code:
while($row mysql_fetch_array($result)) 
  {
                    
    
$ticket $row['ticket_frm'];
    
$rowdate date("d/m/Y",strtotime($row['date_frm']));
    
$id $row['id_frm'];
    
$from $row['from_frm'];
    
$subject $row['subject_frm'];
    
$message $row['message_frm'];
                    
                    
    
$myString $myString "<span><input id=\"check$ticket\" class=\"check\" type=\"checkbox\" name=\"delete\" value=\"$ticket\"></span>";
    
$myString $myString "<div class=\"msgTrue buttonMailTrue\" data-message=\"$message\" data-subject=\"$subject\" data-rowdate=\"%s\" data-from=\"%s\">";
    
$myString $myString "<img src=\"images/sml_new_mail_icon.gif\" class=\"mailIcon\" alt=\"\" />$subject";
    
$myString $myString "<div class=\"rowdate\">$rowdate</div><br />";
    
$myString $myString "<span class=\"mailFrom\">$from</span>";
    
$myString $myString "</div>";
                    
  }
      echo 
$myString
      echo 
'<p class="checked">'.'</p>'
jQuery code

Code:
$(function(){
$("#check" + TICKET_NUMBER_HERE).click(function() {
   var isChecked = $(this).prop("checked");  // or $(this).prop("checked")
     if (isChecked) {
       $("p.checked").html("Checkbox is checked: <b>True</b>");
   } else {
       $("p.checked").html("Checkbox is checked: <b>False</b>");
	 }
	 });
});