SQL linkage and JavaScript