throwing ajax in another function that is ignored