Solving ajax issues