Endorse using javascript and ajax