Ci sono diventato scemo, ma alla fine ho vinto io; come mi hai fatto notare this non funziona nella funzione success, quindi ho dovuto assegnare un id ad ogni link e puntare su quello...
codice:
$("#tabswitch a").click(function (e) {
e.preventDefault();
var url = $(this).attr("href");
var self = "#" + $(this).attr("id");
var testo = $(this).text();
$.ajax({
url: $(this).attr("href"),
async: false,
success: function(result) {
if (result == "hidden") {
var testo2 = testo.replace("nascosta","visualizzata");
var newurl2 = url.replace("hide","display");
$(self).text(testo2);
$(self).attr("href", newurl2);
} else {
var testo2 = testo.replace("visualizzata","nascosta");
var newurl2 = url.replace("display","hide");
$(self).text(testo2);
$(self).attr("href", newurl2);
}
}
});
});
[/PHP]