fixed the ajax delay problem by putting everything in initial request