Found a solution, no more unnecessary ajax calls.