var instance = new readers_cls();
var theID = $('#theID').val();
var thedata = instance.getReaderNumbers(theID);
$.each(thedata.data, function(){
$('#theReader').append('<tr class="readerRow"id="new' + index + '"><td align="center"><input type="text" id="reader' + index + '" name="reader' + index + '" value="' + this.readernumber + '" class="readerName"></td></tr>');
index++;
});
Works fine if I actually have data returned but throws error when returns no data, not sure how to test for the null or not and object on the .each