forse nella funzione success $(this) non referenzia $("#tabswitch a"), prova a sostituire a $(this) il selettore $("#tabswitch a")