javascript function working properly, jquery not displaying results on html page.