Ajax request condition