i am trying to make a table full of check boxes either check or uncheck based on ajax succes. i know how to do it for 1 single variable in a plain table or just a stand alone check box but i cant get the syntax correct for inside the dynamic table–the ajax returns an array with the value of data.returned either 0 or 1 if data.returned is 1 i would like the check box checked and if 0 then unchecked. here is my code
$("#ViewList").click(function() {
$('#loading').show();
$("#GuideMain tbody tr").remove();
$.ajax({
type: "POST",
url: "ViewGMData.php",
dataType: "json",
data: ({VendorPO: $('#VendorPO').val(), Seller: $('#Seller').val(), Title: $('#TitleReRun').val(),
OrderDate: $('#OrderDateEnter').val(), ISBN13:$('#ISBN13UP').val(),
Received:$('#ReceivedEnter').val(),
ReceivedDate:$('#ReceivedDateEnter').val(),
Returned:$('#ReturnedEnter').val(),
Refund:$('#RefundEnter').val()}),
success: function(data){
if (data.message) {
alert ("You Must Pick a Filter");
$('#loading').hide();
}
else{
if(data.ID==null){
$("#GuideMain").append('<tr><td>No Records Found</td></tr>');
$('#loading').hide();
}else{
//append general data
for(var x=0;x<data.ID.length;x++)
{
var textContent=data.Notes;
//code
if (data.returned==1) {
checked1='True';
//code
}
else{
checked1='False';
}
$("#GuideMain").append('<tr><td class="price" id="tableID">'+data.ID[x]+
'</td><td><input type="text12" id="tableVendorPO" value="'+data.PO[x]+
'"/></td><td><input type="text12" id="tableISBN" value="'+data.ISBN[x]+
'"/></td><td><input type="text" id="tableTitle" value="'+data.Title[x]+
'"/></td><td><input type="text9" id="tableQtyOr" value="'+data.QtyOr[x]+
'"/></td><td><input type="text10" id="tablePrice" value="'+data.Price[x]+
'"/></td><td><input type="text12" id="tableGuideRef" value="'+data.GuideRef[x]+
'"/></td><td><input type="text10" id="tablebestprice" value="'+data.bestprice[x]+
'"/></td><td><input type="text12" id="tableOrDate" value="'+data.OrDate[x]+
'"/></td><td><input type="text9" id="tableRcvdQty" value="'+data.RcvdQty[x]+
'"/></td><td><input type="text12" id="tableRcvdDate" value="'+data.RcvdDate[x]+
'"/></td><td><textarea id="tableNotes" >'+textContent[x]+
'</textarea></td><td><input type="checkbox" id="tablereturned" value="'+data.returned[x]+
'"/></td><td><input type="text10" id="tablereturnC" value="'+data.returnC[x]+
'"/></td><td><input type="text10" id="tablerefundF" value="'+data.refundF[x]+
'"/></td><td><input type="text10" id="tablerefundA" value="'+data.refundA[x]+
'"/></td><td><input type="text10" id="tablePubCheck" value="'+data.PubCheck[x]+
'"/></td><td><input type="text10" id="tablePubName" value="'+data.PubName[x]+
'"/></td><td><input type="text10" id="tableResult" value="'+data.Result[x]+
'"/></td></tr>');
you can see one value is a checkbox that is the column i would like to control