Postgresql Get Index Of Array Javascript Appendchild