Make ajax call be synchronous