added attempts = 0 for ajax jquery