function getData(id) {
$.getJSON('process.php?action=lookup&id='+id, parseInfo);
return false;
}
// Display data in form
function parseInfo(data) {
if (data.id > 0) {
$('#txtaction').val('update');
$('#txtbook_id').val(data.id);
} else {
$('#txtaction').val('');
$('#txtbook_id').val('');
}
}
Referring to the method above, is this the proper way to populate form fields? Will it cause any problem when calling getData function if i have a long list of form fields to populate and attributes to change?
Thank you in advance for any comments!